Skip to content

Wrong error for late var in this_reference_in_late_field_test, class_member_declarations_test #37857

Closed
@eernstg

Description

@eernstg

In the test language_2/nnbd/static_errors/this_reference_in_late_field_test.dart, case 01 has a variable declared late var x = this;. With NNBD this is not an error (cf. this grammar rule and this issue comment), but the analyzer reports the following error:

ERROR|SYNTACTIC_ERROR|CONFLICTING_MODIFIERS|/b/s/w/ir/cache/builder/sdk/out/ReleaseX64/generated_tests/language_2/nnbd/static_errors/this_reference_in_late_field_test_01.dart|14|8|3|Members can't be declared to be both 'var' and 'late'.

The same issue exists for declarations starting with late var in language_2/nnbd/syntax/class_member_declarations_test.dart.

Metadata

Metadata

Assignees

Labels

legacy-area-analyzerUse area-devexp instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions