@@ -22,6 +22,7 @@ void main(List<String> args) async {
22
22
legacyCode: false ,
23
23
moduleFormat: ModuleFormat .amd,
24
24
args: args,
25
+ enableExperiments: ['inline-class' ],
25
26
);
26
27
runSharedTests (setup, driver);
27
28
});
@@ -34,6 +35,7 @@ void main(List<String> args) async {
34
35
legacyCode: false ,
35
36
moduleFormat: ModuleFormat .amd,
36
37
args: args,
38
+ enableExperiments: ['inline-class' ],
37
39
);
38
40
runSharedTests (setup, driver);
39
41
});
@@ -63,6 +65,16 @@ class BaseClass {
63
65
BaseClass? nullableField;
64
66
AnotherClass nonNullableField = AnotherClass();
65
67
68
+ Ext get extensionTypeGetter => Ext(AnotherClass());
69
+ Ext get _privateExtensionTypeGetter => Ext(AnotherClass());
70
+ ExtString extensionTypeField = ExtString('hello');
71
+ ExtString _privateExtensionTypeField = ExtString('hello');
72
+ static const ExtDuration staticConstExtensionTypeField =
73
+ const ExtDuration(Duration.zero);
74
+ static ExtDuration staticExtensionTypeField = ExtDuration(Duration.zero);
75
+ static final ExtDuration staticFinalExtensionTypeField =
76
+ ExtDuration(Duration.zero);
77
+
66
78
BaseClass(this.field, this._field) {
67
79
int y = 1;
68
80
lateFinalField = 35;
@@ -96,6 +108,12 @@ class AnotherClass {
96
108
int a = 0;
97
109
}
98
110
111
+ extension type Ext(AnotherClass _) {}
112
+
113
+ extension type ExtString(String _) {}
114
+
115
+ extension type const ExtDuration(Duration _) {}
116
+
99
117
main() {
100
118
int x = 15;
101
119
var derived = DerivedClass();
@@ -195,6 +213,20 @@ void runSharedTests(
195
213
'staticField' : {'isStatic' : true },
196
214
'_staticField' : {'isStatic' : true },
197
215
'_unusedStaticField' : {'isStatic' : true },
216
+ // NOTE: Fields typed as an extension type appear as their static
217
+ // erased type for now. This isn't necessarily the runtime type
218
+ // of the value either.
219
+ 'extensionTypeField' : {
220
+ 'className' : 'String' ,
221
+ 'classLibraryId' : 'dart:core' ,
222
+ },
223
+ '_privateExtensionTypeField' : {
224
+ 'className' : 'String' ,
225
+ 'classLibraryId' : 'dart:core' ,
226
+ },
227
+ 'staticConstExtensionTypeField' : {'isStatic' : true },
228
+ 'staticExtensionTypeField' : {'isStatic' : true },
229
+ 'staticFinalExtensionTypeField' : {'isStatic' : true },
198
230
},
199
231
'methods' : {
200
232
'method' : {},
@@ -204,6 +236,8 @@ void runSharedTests(
204
236
'_privateGetter' : {'isGetter' : true },
205
237
'factory' : {'isStatic' : true },
206
238
'staticMethod' : {'isStatic' : true },
239
+ 'extensionTypeGetter' : {'isGetter' : true },
240
+ '_privateExtensionTypeGetter' : {'isGetter' : true },
207
241
},
208
242
});
209
243
});
@@ -237,6 +271,8 @@ void runSharedTests(
237
271
'_privateGetter' : {'isGetter' : true },
238
272
'factory' : {'isStatic' : true },
239
273
'staticMethod' : {'isStatic' : true },
274
+ 'extensionTypeGetter' : {'isGetter' : true },
275
+ '_privateExtensionTypeGetter' : {'isGetter' : true },
240
276
},
241
277
});
242
278
});
@@ -529,7 +565,9 @@ void runSharedTests(
529
565
expectedResult: [
530
566
'_field' ,
531
567
'_newPrivateField' ,
568
+ '_privateExtensionTypeField' ,
532
569
'_unusedField' ,
570
+ 'extensionTypeField' ,
533
571
'field' ,
534
572
'functionField' ,
535
573
'lateFinalField' ,
@@ -545,7 +583,9 @@ void runSharedTests(
545
583
expression: 'dart.getObjectFieldNames(base)' ,
546
584
expectedResult: [
547
585
'_field' ,
586
+ '_privateExtensionTypeField' ,
548
587
'_unusedField' ,
588
+ 'extensionTypeField' ,
549
589
'field' ,
550
590
'functionField' ,
551
591
'lateFinalField' ,
0 commit comments