Version 2.11.0-249.0.dev
Merge commit '5a6129406fe750515536704dd22bdf50b55b42d5' into 'dev'
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
index 9c829d4..6b2b389 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
@@ -6201,7 +6201,7 @@
// identifier, then allow ensureIdentifier to report an error
// and don't report errors here.
if (varFinalOrConst == null) {
- if (typeInfo == noType && lateToken == null) {
+ if (typeInfo == noType) {
reportRecoverableError(next, codes.messageMissingConstFinalVarOrType);
}
} else if (optional('var', varFinalOrConst)) {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/make_variable_nullable_test.dart b/pkg/analysis_server/test/src/services/correction/fix/make_variable_nullable_test.dart
index 133daf5..b38dd55 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/make_variable_nullable_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/make_variable_nullable_test.dart
@@ -61,7 +61,7 @@
Future<void> test_noKeywordOrType() async {
await resolveTestUnit('''
void f() {
- late s = '';
+ late var s = '';
s = null;
print(s);
}
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 3ec551f..c9df73a 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -710,7 +710,7 @@
// ```dart
// %experiments=non-nullable
// Future<int> f() async {
- // late v = [!await!] 42;
+ // late var v = [!await!] 42;
// return v;
// }
// ```
@@ -722,7 +722,7 @@
// ```dart
// %experiments=non-nullable
// Future<int> f() async {
- // late v = 42;
+ // late var v = 42;
// return v;
// }
// ```
diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart
index 3046a23..d2cfceb 100644
--- a/pkg/analyzer/test/generated/parser_fasta_test.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_test.dart
@@ -3814,7 +3814,9 @@
var statement = parseStatement('late a;', featureSet: nonNullable)
as VariableDeclarationStatement;
var declarationList = statement.variables;
- assertNoErrors();
+ assertErrors(errors: [
+ expectedError(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, 5, 1)
+ ]);
expect(declarationList.keyword, isNull);
expect(declarationList.type, isNull);
expect(declarationList.variables, hasLength(1));
@@ -3834,7 +3836,9 @@
var statement = parseStatement('late a = 0;', featureSet: nonNullable)
as VariableDeclarationStatement;
var declarationList = statement.variables;
- assertNoErrors();
+ assertErrors(errors: [
+ expectedError(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, 5, 1)
+ ]);
expect(declarationList.keyword, isNull);
expect(declarationList.type, isNull);
expect(declarationList.variables, hasLength(1));
@@ -3862,6 +3866,17 @@
expect(declarationList.variables, hasLength(1));
}
+ void test_parseVariableDeclaration_late_var_init() {
+ var statement = parseStatement('late var a = 0;', featureSet: nonNullable)
+ as VariableDeclarationStatement;
+ var declarationList = statement.variables;
+ assertNoErrors();
+ expect(declarationList.lateKeyword, isNotNull);
+ expect(declarationList.keyword?.lexeme, 'var');
+ expect(declarationList.type, isNull);
+ expect(declarationList.variables, hasLength(1));
+ }
+
void test_typeAlias_37733() {
// https://github.com/dart-lang/sdk/issues/37733
var unit = parseCompilationUnit(r'typedef K=Function(<>($', errors: [
diff --git a/pkg/analyzer/test/src/diagnostics/await_in_late_local_variable_initializer_test.dart b/pkg/analyzer/test/src/diagnostics/await_in_late_local_variable_initializer_test.dart
index c321778..8a372ff 100644
--- a/pkg/analyzer/test/src/diagnostics/await_in_late_local_variable_initializer_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/await_in_late_local_variable_initializer_test.dart
@@ -23,31 +23,31 @@
await assertErrorsInCode('''
main() {
var v = () async {
- late v2 = await 42;
+ late var v2 = await 42;
print(v2);
};
print(v);
}
''', [
- error(_errorCode, 44, 5),
+ error(_errorCode, 48, 5),
]);
}
test_late_await() async {
await assertErrorsInCode('''
main() async {
- late v = await 42;
+ late var v = await 42;
print(v);
}
''', [
- error(_errorCode, 26, 5),
+ error(_errorCode, 30, 5),
]);
}
test_late_await_inClosure_blockBody() async {
await assertNoErrorsInCode('''
main() async {
- late v = () async {
+ late var v = () async {
await 42;
};
print(v);
@@ -58,7 +58,7 @@
test_late_await_inClosure_expressionBody() async {
await assertNoErrorsInCode('''
main() async {
- late v = () async => await 42;
+ late var v = () async => await 42;
print(v);
}
''');
@@ -67,7 +67,7 @@
test_no_await() async {
await assertNoErrorsInCode('''
main() async {
- late v = 42;
+ late var v = 42;
print(v);
}
''');
diff --git a/pkg/analyzer/tool/diagnostics/diagnostics.md b/pkg/analyzer/tool/diagnostics/diagnostics.md
index 2d364dd..ef05f7e 100644
--- a/pkg/analyzer/tool/diagnostics/diagnostics.md
+++ b/pkg/analyzer/tool/diagnostics/diagnostics.md
@@ -744,7 +744,7 @@
{% prettify dart tag=pre+code %}
Future<int> f() async {
- late v = [!await!] 42;
+ late var v = [!await!] 42;
return v;
}
{% endprettify %}
@@ -755,7 +755,7 @@
{% prettify dart tag=pre+code %}
Future<int> f() async {
- late v = 42;
+ late var v = 42;
return v;
}
{% endprettify %}
diff --git a/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart b/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart
new file mode 100644
index 0000000..b228c24
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart
@@ -0,0 +1,21 @@
+// https://github.com/dart-lang/sdk/issues/43811
+// https://github.com/dart-lang/sdk/issues/43812
+// https://github.com/dart-lang/sdk/issues/43813
+
+void main() {
+ late x;
+}
+
+late y;
+
+class Foo {
+ late z;
+
+ void foo() {
+ late x;
+ }
+
+ static void bar() {
+ late x;
+ }
+}
\ No newline at end of file
diff --git a/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart.expect b/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart.expect
new file mode 100644
index 0000000..5ec7a5e
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart.expect
@@ -0,0 +1,133 @@
+Problems reported:
+
+parser/nnbd/error_recovery/late_without_var_etc:6:8: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+ late x;
+ ^
+
+parser/nnbd/error_recovery/late_without_var_etc:9:6: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+late y;
+ ^
+
+parser/nnbd/error_recovery/late_without_var_etc:12:8: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+ late z;
+ ^
+
+parser/nnbd/error_recovery/late_without_var_etc:15:10: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+ late x;
+ ^
+
+parser/nnbd/error_recovery/late_without_var_etc:19:10: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+ late x;
+ ^
+
+beginCompilationUnit(void)
+ beginMetadataStar(void)
+ endMetadataStar(0)
+ beginTopLevelMember(void)
+ beginTopLevelMethod(, null)
+ handleVoidKeyword(void)
+ handleIdentifier(main, topLevelFunctionDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.TopLevelMethod)
+ endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ handleRecoverableError(MissingConstFinalVarOrType, x, x)
+ beginMetadataStar(late)
+ endMetadataStar(0)
+ handleNoType(late)
+ beginVariablesDeclaration(x, late, null)
+ handleIdentifier(x, localVariableDeclaration)
+ beginInitializedIdentifier(x)
+ handleNoVariableInitializer(x)
+ endInitializedIdentifier(x)
+ endVariablesDeclaration(1, ;)
+ endBlockFunctionBody(1, {, })
+ endTopLevelMethod(void, null, })
+ endTopLevelDeclaration(late)
+ beginMetadataStar(late)
+ endMetadataStar(0)
+ beginTopLevelMember(late)
+ beginFields(})
+ handleRecoverableError(MissingConstFinalVarOrType, y, y)
+ handleNoType(late)
+ handleIdentifier(y, topLevelVariableDeclaration)
+ handleNoFieldInitializer(;)
+ endTopLevelFields(null, null, null, late, null, 1, late, ;)
+ endTopLevelDeclaration(class)
+ beginMetadataStar(class)
+ endMetadataStar(0)
+ beginClassOrNamedMixinApplicationPrelude(class)
+ handleIdentifier(Foo, classOrMixinDeclaration)
+ handleNoTypeVariables({)
+ beginClassDeclaration(class, null, Foo)
+ handleNoType(Foo)
+ handleClassExtends(null, 1)
+ handleClassNoWithClause()
+ handleClassOrMixinImplements(null, 0)
+ handleClassHeader(class, class, null)
+ beginClassOrMixinBody(DeclarationKind.Class, {)
+ beginMetadataStar(late)
+ endMetadataStar(0)
+ beginMember()
+ beginFields({)
+ handleRecoverableError(MissingConstFinalVarOrType, z, z)
+ handleNoType(late)
+ handleIdentifier(z, fieldDeclaration)
+ handleNoFieldInitializer(;)
+ endClassFields(null, null, null, null, late, null, 1, late, ;)
+ endMember()
+ beginMetadataStar(void)
+ endMetadataStar(0)
+ beginMember()
+ beginMethod(null, null, null, null, null, foo)
+ handleVoidKeyword(void)
+ handleIdentifier(foo, methodDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.NonStaticMethod)
+ endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
+ handleNoInitializers()
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ handleRecoverableError(MissingConstFinalVarOrType, x, x)
+ beginMetadataStar(late)
+ endMetadataStar(0)
+ handleNoType(late)
+ beginVariablesDeclaration(x, late, null)
+ handleIdentifier(x, localVariableDeclaration)
+ beginInitializedIdentifier(x)
+ handleNoVariableInitializer(x)
+ endInitializedIdentifier(x)
+ endVariablesDeclaration(1, ;)
+ endBlockFunctionBody(1, {, })
+ endClassMethod(null, void, (, null, })
+ endMember()
+ beginMetadataStar(static)
+ endMetadataStar(0)
+ beginMember()
+ beginMethod(null, static, null, null, null, bar)
+ handleVoidKeyword(void)
+ handleIdentifier(bar, methodDeclaration)
+ handleNoTypeVariables(()
+ beginFormalParameters((, MemberKind.StaticMethod)
+ endFormalParameters(0, (, ), MemberKind.StaticMethod)
+ handleNoInitializers()
+ handleAsyncModifier(null, null)
+ beginBlockFunctionBody({)
+ handleRecoverableError(MissingConstFinalVarOrType, x, x)
+ beginMetadataStar(late)
+ endMetadataStar(0)
+ handleNoType(late)
+ beginVariablesDeclaration(x, late, null)
+ handleIdentifier(x, localVariableDeclaration)
+ beginInitializedIdentifier(x)
+ handleNoVariableInitializer(x)
+ endInitializedIdentifier(x)
+ endVariablesDeclaration(1, ;)
+ endBlockFunctionBody(1, {, })
+ endClassMethod(null, static, (, null, })
+ endMember()
+ endClassOrMixinBody(DeclarationKind.Class, 3, {, })
+ endClassDeclaration(class, })
+ endTopLevelDeclaration()
+endCompilationUnit(3, )
diff --git a/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart.intertwined.expect
new file mode 100644
index 0000000..13b0274
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart.intertwined.expect
@@ -0,0 +1,224 @@
+parseUnit(void)
+ skipErrorTokens(void)
+ listener: beginCompilationUnit(void)
+ syntheticPreviousToken(void)
+ parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+ parseMetadataStar()
+ listener: beginMetadataStar(void)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl()
+ listener: beginTopLevelMember(void)
+ parseTopLevelMethod(, null, , Instance of 'VoidType', null, main, false)
+ listener: beginTopLevelMethod(, null)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
+ listener: handleIdentifier(main, topLevelFunctionDeclaration)
+ parseMethodTypeVar(main)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(main, main, false, MemberKind.TopLevelMethod)
+ parseFormalParameters(main, MemberKind.TopLevelMethod)
+ parseFormalParametersRest((, MemberKind.TopLevelMethod)
+ listener: beginFormalParameters((, MemberKind.TopLevelMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, late)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclaration({, false)
+ parseExpressionStatementOrDeclarationAfterModifiers(late, {, late, null, null, false)
+ looksLikeLocalFunction(x)
+ reportRecoverableError(x, MissingConstFinalVarOrType)
+ listener: handleRecoverableError(MissingConstFinalVarOrType, x, x)
+ listener: beginMetadataStar(late)
+ listener: endMetadataStar(0)
+ listener: handleNoType(late)
+ listener: beginVariablesDeclaration(x, late, null)
+ parseVariablesDeclarationRest(late, true)
+ parseOptionallyInitializedIdentifier(late)
+ ensureIdentifier(late, localVariableDeclaration)
+ listener: handleIdentifier(x, localVariableDeclaration)
+ listener: beginInitializedIdentifier(x)
+ parseVariableInitializerOpt(x)
+ listener: handleNoVariableInitializer(x)
+ listener: endInitializedIdentifier(x)
+ ensureSemicolon(x)
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(1, {, })
+ listener: endTopLevelMethod(void, null, })
+ listener: endTopLevelDeclaration(late)
+ parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+ parseMetadataStar(})
+ listener: beginMetadataStar(late)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl(})
+ listener: beginTopLevelMember(late)
+ isReservedKeyword(;)
+ parseFields(}, null, null, null, null, late, null, late, Instance of 'NoType', y, DeclarationKind.TopLevel, null, false)
+ listener: beginFields(})
+ reportRecoverableError(y, MissingConstFinalVarOrType)
+ listener: handleRecoverableError(MissingConstFinalVarOrType, y, y)
+ listener: handleNoType(late)
+ ensureIdentifierPotentiallyRecovered(late, topLevelVariableDeclaration, false)
+ listener: handleIdentifier(y, topLevelVariableDeclaration)
+ parseFieldInitializerOpt(y, y, late, null, null, null, DeclarationKind.TopLevel, null)
+ listener: handleNoFieldInitializer(;)
+ listener: endTopLevelFields(null, null, null, late, null, 1, late, ;)
+ listener: endTopLevelDeclaration(class)
+ parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
+ parseMetadataStar(;)
+ listener: beginMetadataStar(class)
+ listener: endMetadataStar(0)
+ parseTopLevelKeywordDeclaration(;, class, Instance of 'DirectiveContext')
+ parseClassDeclarationModifiers(;, class)
+ parseClassOrNamedMixinApplication(null, class)
+ listener: beginClassOrNamedMixinApplicationPrelude(class)
+ ensureIdentifier(class, classOrMixinDeclaration)
+ listener: handleIdentifier(Foo, classOrMixinDeclaration)
+ listener: handleNoTypeVariables({)
+ listener: beginClassDeclaration(class, null, Foo)
+ parseClass(Foo, class, class, Foo)
+ parseClassHeaderOpt(Foo, class, class)
+ parseClassExtendsOpt(Foo)
+ listener: handleNoType(Foo)
+ listener: handleClassExtends(null, 1)
+ parseWithClauseOpt(Foo)
+ listener: handleClassNoWithClause()
+ parseClassOrMixinImplementsOpt(Foo)
+ listener: handleClassOrMixinImplements(null, 0)
+ listener: handleClassHeader(class, class, null)
+ parseClassOrMixinOrExtensionBody(Foo, DeclarationKind.Class, Foo)
+ listener: beginClassOrMixinBody(DeclarationKind.Class, {)
+ notEofOrValue(}, late)
+ parseClassOrMixinOrExtensionMemberImpl({, DeclarationKind.Class, Foo)
+ parseMetadataStar({)
+ listener: beginMetadataStar(late)
+ listener: endMetadataStar(0)
+ listener: beginMember()
+ isReservedKeyword(;)
+ parseFields({, null, null, null, null, late, null, late, Instance of 'NoType', z, DeclarationKind.Class, Foo, false)
+ listener: beginFields({)
+ reportRecoverableError(z, MissingConstFinalVarOrType)
+ listener: handleRecoverableError(MissingConstFinalVarOrType, z, z)
+ listener: handleNoType(late)
+ ensureIdentifierPotentiallyRecovered(late, fieldDeclaration, false)
+ listener: handleIdentifier(z, fieldDeclaration)
+ parseFieldInitializerOpt(z, z, late, null, null, null, DeclarationKind.Class, Foo)
+ listener: handleNoFieldInitializer(;)
+ listener: endClassFields(null, null, null, null, late, null, 1, late, ;)
+ listener: endMember()
+ notEofOrValue(}, void)
+ parseClassOrMixinOrExtensionMemberImpl(;, DeclarationKind.Class, Foo)
+ parseMetadataStar(;)
+ listener: beginMetadataStar(void)
+ listener: endMetadataStar(0)
+ listener: beginMember()
+ parseMethod(;, null, null, null, null, null, null, ;, Instance of 'VoidType', null, foo, DeclarationKind.Class, Foo, false)
+ listener: beginMethod(null, null, null, null, null, foo)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(void, methodDeclaration, false)
+ listener: handleIdentifier(foo, methodDeclaration)
+ parseQualifiedRestOpt(foo, methodDeclarationContinuation)
+ parseMethodTypeVar(foo)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(foo, foo, false, MemberKind.NonStaticMethod)
+ parseFormalParameters(foo, MemberKind.NonStaticMethod)
+ parseFormalParametersRest((, MemberKind.NonStaticMethod)
+ listener: beginFormalParameters((, MemberKind.NonStaticMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
+ parseInitializersOpt())
+ listener: handleNoInitializers()
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ inPlainSync()
+ parseFunctionBody(), false, true)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, late)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclaration({, false)
+ parseExpressionStatementOrDeclarationAfterModifiers(late, {, late, null, null, false)
+ looksLikeLocalFunction(x)
+ reportRecoverableError(x, MissingConstFinalVarOrType)
+ listener: handleRecoverableError(MissingConstFinalVarOrType, x, x)
+ listener: beginMetadataStar(late)
+ listener: endMetadataStar(0)
+ listener: handleNoType(late)
+ listener: beginVariablesDeclaration(x, late, null)
+ parseVariablesDeclarationRest(late, true)
+ parseOptionallyInitializedIdentifier(late)
+ ensureIdentifier(late, localVariableDeclaration)
+ listener: handleIdentifier(x, localVariableDeclaration)
+ listener: beginInitializedIdentifier(x)
+ parseVariableInitializerOpt(x)
+ listener: handleNoVariableInitializer(x)
+ listener: endInitializedIdentifier(x)
+ ensureSemicolon(x)
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(1, {, })
+ listener: endClassMethod(null, void, (, null, })
+ listener: endMember()
+ notEofOrValue(}, static)
+ parseClassOrMixinOrExtensionMemberImpl(}, DeclarationKind.Class, Foo)
+ parseMetadataStar(})
+ listener: beginMetadataStar(static)
+ listener: endMetadataStar(0)
+ listener: beginMember()
+ parseMethod(}, null, null, static, null, null, null, static, Instance of 'VoidType', null, bar, DeclarationKind.Class, Foo, false)
+ listener: beginMethod(null, static, null, null, null, bar)
+ listener: handleVoidKeyword(void)
+ ensureIdentifierPotentiallyRecovered(void, methodDeclaration, false)
+ listener: handleIdentifier(bar, methodDeclaration)
+ parseQualifiedRestOpt(bar, methodDeclarationContinuation)
+ parseMethodTypeVar(bar)
+ listener: handleNoTypeVariables(()
+ parseGetterOrFormalParameters(bar, bar, false, MemberKind.StaticMethod)
+ parseFormalParameters(bar, MemberKind.StaticMethod)
+ parseFormalParametersRest((, MemberKind.StaticMethod)
+ listener: beginFormalParameters((, MemberKind.StaticMethod)
+ listener: endFormalParameters(0, (, ), MemberKind.StaticMethod)
+ parseInitializersOpt())
+ listener: handleNoInitializers()
+ parseAsyncModifierOpt())
+ listener: handleAsyncModifier(null, null)
+ inPlainSync()
+ parseFunctionBody(), false, false)
+ listener: beginBlockFunctionBody({)
+ notEofOrValue(}, late)
+ parseStatement({)
+ parseStatementX({)
+ parseExpressionStatementOrDeclaration({, false)
+ parseExpressionStatementOrDeclarationAfterModifiers(late, {, late, null, null, false)
+ looksLikeLocalFunction(x)
+ reportRecoverableError(x, MissingConstFinalVarOrType)
+ listener: handleRecoverableError(MissingConstFinalVarOrType, x, x)
+ listener: beginMetadataStar(late)
+ listener: endMetadataStar(0)
+ listener: handleNoType(late)
+ listener: beginVariablesDeclaration(x, late, null)
+ parseVariablesDeclarationRest(late, true)
+ parseOptionallyInitializedIdentifier(late)
+ ensureIdentifier(late, localVariableDeclaration)
+ listener: handleIdentifier(x, localVariableDeclaration)
+ listener: beginInitializedIdentifier(x)
+ parseVariableInitializerOpt(x)
+ listener: handleNoVariableInitializer(x)
+ listener: endInitializedIdentifier(x)
+ ensureSemicolon(x)
+ listener: endVariablesDeclaration(1, ;)
+ notEofOrValue(}, })
+ listener: endBlockFunctionBody(1, {, })
+ listener: endClassMethod(null, static, (, null, })
+ listener: endMember()
+ notEofOrValue(}, })
+ listener: endClassOrMixinBody(DeclarationKind.Class, 3, {, })
+ listener: endClassDeclaration(class, })
+ listener: endTopLevelDeclaration()
+ reportAllErrorTokens(void)
+ listener: endCompilationUnit(3, )
diff --git a/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart.parser.expect b/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart.parser.expect
new file mode 100644
index 0000000..3842dc9
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart.parser.expect
@@ -0,0 +1,35 @@
+void main() {
+late x;
+}
+
+late y;
+
+class Foo {
+late z;
+
+void foo() {
+late x;
+}
+
+static void bar() {
+late x;
+}
+}
+
+void[KeywordToken] main[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+late[KeywordToken] x[StringToken];[SimpleToken]
+}[SimpleToken]
+
+late[KeywordToken] y[StringToken];[SimpleToken]
+
+class[KeywordToken] Foo[StringToken] {[BeginToken]
+late[KeywordToken] z[StringToken];[SimpleToken]
+
+void[KeywordToken] foo[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+late[KeywordToken] x[StringToken];[SimpleToken]
+}[SimpleToken]
+
+static[KeywordToken] void[KeywordToken] bar[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+late[KeywordToken] x[StringToken];[SimpleToken]
+}[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart.scanner.expect b/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart.scanner.expect
new file mode 100644
index 0000000..3842dc9
--- /dev/null
+++ b/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart.scanner.expect
@@ -0,0 +1,35 @@
+void main() {
+late x;
+}
+
+late y;
+
+class Foo {
+late z;
+
+void foo() {
+late x;
+}
+
+static void bar() {
+late x;
+}
+}
+
+void[KeywordToken] main[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+late[KeywordToken] x[StringToken];[SimpleToken]
+}[SimpleToken]
+
+late[KeywordToken] y[StringToken];[SimpleToken]
+
+class[KeywordToken] Foo[StringToken] {[BeginToken]
+late[KeywordToken] z[StringToken];[SimpleToken]
+
+void[KeywordToken] foo[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+late[KeywordToken] x[StringToken];[SimpleToken]
+}[SimpleToken]
+
+static[KeywordToken] void[KeywordToken] bar[StringToken]([BeginToken])[SimpleToken] {[BeginToken]
+late[KeywordToken] x[StringToken];[SimpleToken]
+}[SimpleToken]
+}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/test/parser_suite.dart b/pkg/front_end/test/parser_suite.dart
index 79145fb..9e03711 100644
--- a/pkg/front_end/test/parser_suite.dart
+++ b/pkg/front_end/test/parser_suite.dart
@@ -53,6 +53,8 @@
import 'parser_test_parser.dart' show TestParser;
+import 'testing_utils.dart' show checkEnvironment;
+
const String EXPECTATIONS = '''
[
{
@@ -71,8 +73,18 @@
Future<Context> createContext(
Chain suite, Map<String, String> environment) async {
- return new Context(suite.name, environment["updateExpectations"] == "true",
- environment["trace"] == "true", environment["annotateLines"] == "true");
+ const Set<String> knownEnvironmentKeys = {
+ "updateExpectations",
+ "trace",
+ "annotateLines"
+ };
+ checkEnvironment(environment, knownEnvironmentKeys);
+
+ bool updateExpectations = environment["updateExpectations"] == "true";
+ bool trace = environment["trace"] == "true";
+ bool annotateLines = environment["annotateLines"] == "true";
+
+ return new Context(suite.name, updateExpectations, trace, annotateLines);
}
ScannerConfiguration scannerConfiguration = new ScannerConfiguration(
diff --git a/pkg/front_end/testcases/late_lowering/definitely_unassigned.dart.textual_outline.expect b/pkg/front_end/testcases/late_lowering/definitely_unassigned.dart.textual_outline.expect
index f27c6c0..8b2d8e6 100644
--- a/pkg/front_end/testcases/late_lowering/definitely_unassigned.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/late_lowering/definitely_unassigned.dart.textual_outline.expect
@@ -1,64 +1,8 @@
import 'dart:async';
-
methodDirect<T>(T value) {}
-var fieldDirect = <T>(T value) {
- T local1;
- late T;
- local2;
- int local3;
- late int;
- local4;
- FutureOr<int> local5;
- late FutureOr;
- <int>[];
- local6;
- late T;
- local7 = value;
- local1;
- local2;
- local3;
- local4;
- local5;
- local6;
- local7;
-};
+var fieldDirect = <T>(T value) { T local1; late T ;local2; int local3; late int ;local4; FutureOr<int> local5; late FutureOr;<int> [];local6; late T ;local7 = value; local1; local2; local3; local4; local5; local6; local7; };
methodConditional<T>(bool b, T value) {}
-var fieldConditional = <T>(bool b, T value) {
- T local1;
- late T;
- local2;
- int local3;
- late int;
- local4;
- FutureOr<int> local5;
- late FutureOr;
- <int>[];
- local6;
- late T;
- local7 = value;
- if (b) {
- local1 = value;
- local2 = value;
- local3 = 0;
- local4 = 0;
- local5 = 0;
- local6 = 0;
- local7;
- }
- local1;
- local2;
- local3;
- local4;
- local5;
- local6;
- local7;
-};
+var fieldConditional = <T>(bool b, T value) { T local1; late T ;local2; int local3; late int ;local4; FutureOr<int> local5; late FutureOr;<int> [];local6; late T ;local7 = value; if (b) { local1 = value; local2 = value; local3 = 0; local4 = 0; local5 = 0; local6 = 0; local7; } local1; local2; local3; local4; local5; local6; local7; };
methodCompound() {}
-var fieldCompound = () {
- int local3;
- late int;
- local4;
- local3 += 0;
- local4 += 0;
-};
+var fieldCompound = () { int local3; late int ;local4; local3 += 0; local4 += 0; };
main() {}
diff --git a/pkg/front_end/testcases/nnbd/definitely_unassigned.dart.textual_outline.expect b/pkg/front_end/testcases/nnbd/definitely_unassigned.dart.textual_outline.expect
index f27c6c0..8b2d8e6 100644
--- a/pkg/front_end/testcases/nnbd/definitely_unassigned.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/nnbd/definitely_unassigned.dart.textual_outline.expect
@@ -1,64 +1,8 @@
import 'dart:async';
-
methodDirect<T>(T value) {}
-var fieldDirect = <T>(T value) {
- T local1;
- late T;
- local2;
- int local3;
- late int;
- local4;
- FutureOr<int> local5;
- late FutureOr;
- <int>[];
- local6;
- late T;
- local7 = value;
- local1;
- local2;
- local3;
- local4;
- local5;
- local6;
- local7;
-};
+var fieldDirect = <T>(T value) { T local1; late T ;local2; int local3; late int ;local4; FutureOr<int> local5; late FutureOr;<int> [];local6; late T ;local7 = value; local1; local2; local3; local4; local5; local6; local7; };
methodConditional<T>(bool b, T value) {}
-var fieldConditional = <T>(bool b, T value) {
- T local1;
- late T;
- local2;
- int local3;
- late int;
- local4;
- FutureOr<int> local5;
- late FutureOr;
- <int>[];
- local6;
- late T;
- local7 = value;
- if (b) {
- local1 = value;
- local2 = value;
- local3 = 0;
- local4 = 0;
- local5 = 0;
- local6 = 0;
- local7;
- }
- local1;
- local2;
- local3;
- local4;
- local5;
- local6;
- local7;
-};
+var fieldConditional = <T>(bool b, T value) { T local1; late T ;local2; int local3; late int ;local4; FutureOr<int> local5; late FutureOr;<int> [];local6; late T ;local7 = value; if (b) { local1 = value; local2 = value; local3 = 0; local4 = 0; local5 = 0; local6 = 0; local7; } local1; local2; local3; local4; local5; local6; local7; };
methodCompound() {}
-var fieldCompound = () {
- int local3;
- late int;
- local4;
- local3 += 0;
- local4 += 0;
-};
+var fieldCompound = () { int local3; late int ;local4; local3 += 0; local4 += 0; };
main() {}
diff --git a/pkg/front_end/testcases/textual_outline.status b/pkg/front_end/testcases/textual_outline.status
index 3be2c16..015fa36 100644
--- a/pkg/front_end/testcases/textual_outline.status
+++ b/pkg/front_end/testcases/textual_outline.status
@@ -137,6 +137,7 @@
inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1: FormatterCrash
inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1: FormatterCrash
late_lowering/covariant_late_field: FormatterCrash
+late_lowering/definitely_unassigned: FormatterCrash
late_lowering/getter_vs_setter_type: FormatterCrash
late_lowering/infer_late_field_type: FormatterCrash
late_lowering/initializer_rewrite: FormatterCrash
@@ -171,6 +172,7 @@
late_lowering_sentinel/late_fields: FormatterCrash
nnbd/abstract_field_errors: FormatterCrash
nnbd/covariant_late_field: FormatterCrash
+nnbd/definitely_unassigned: FormatterCrash
nnbd/extension_bounds: FormatterCrash
nnbd/extension_never: FormatterCrash
nnbd/extension_type_variable_bound: FormatterCrash
diff --git a/tests/language/operator/number_operator_error_test.dart b/tests/language/operator/number_operator_error_test.dart
index aaa32c3..c50f26e 100644
--- a/tests/language/operator/number_operator_error_test.dart
+++ b/tests/language/operator/number_operator_error_test.dart
@@ -26,7 +26,7 @@
if (on is! num) throw "promote on to I&num";
checkIntersectionType<O, num>(on, on, on);
dynamic dyn = cast(1);
- late never = throw "unreachable";
+ late var never = throw "unreachable";
/* indent */ i + "string";
// ^^^^^^^^
diff --git a/tools/VERSION b/tools/VERSION
index 0e82789a..4c85e50 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 11
PATCH 0
-PRERELEASE 248
+PRERELEASE 249
PRERELEASE_PATCH 0
\ No newline at end of file