File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ class ConstantInitializersResolver {
9999 InferenceContext .setType (variable.initializer, typeNode.type);
100100 return variable.initializer;
101101 },
102+ isTopLevelVariableInitializer: true ,
102103 );
103104 }
104105 }
Original file line number Diff line number Diff line change @@ -3996,6 +3996,24 @@ const Symbol vSymbol = #aaa.bbb.ccc;
39963996''' );
39973997 }
39983998
3999+ test_const_topLevel_nullSafe_nullAware_propertyAccess () async {
4000+ featureSet = enableNnbd;
4001+ var library = await checkLibrary (r'''
4002+ const String? a = '';
4003+
4004+ const List<int?> b = [
4005+ a?.length,
4006+ ];
4007+ ''' );
4008+ // TODO(scheglov) include fully resolved AST, when types with suffixes
4009+ checkElementText (library, r'''
4010+ const String a = '';
4011+ const List<int> b = [
4012+ a/*location: test.dart;a?*/.
4013+ length/*location: dart:core;String;length?*/];
4014+ ''' );
4015+ }
4016+
39994017 test_const_topLevel_parenthesis () async {
40004018 var library = await checkLibrary (r'''
40014019const int v1 = (1 + 2) * 3;
You can’t perform that action at this time.
0 commit comments