Skip to content

[Wildcard Variables] implement THIS_ACCESS_FROM_FIELD_INITIALIZER #56442

@pq

Description

@pq

The front-end has this error:

ThisAccessInFieldInitializer:
  problemMessage: "Can't access 'this' in a field initializer to read '#name'."
  analyzerCode: THIS_ACCESS_FROM_FIELD_INITIALIZER

that names THIS_ACCESS_FROM_FIELD_INITIALIZER (which doesn't exist).

That said, we do have IMPLICIT_THIS_REFERENCE_IN_INITIALIZER.

@kallentu: any reason we need a new error code here and can't use IMPLICIT_THIS_REFERENCE_IN_INITIALIZER?

Here's the relevant part of the spec:

https://github.com/dart-lang/language/blob/main/working/wildcards/feature-specification.md#initializing-formals

A corresponding (failing) test:

https://dart-ci.appspot.com/log/any/analyzer-asserts-linux/25960/language/wildcard_variables/initializing_formal_parameters/this_initializer_access_error_test

(There are co19 ones too.)

Metadata

Metadata

Assignees

Labels

P1A high priority bug; for example, a single project is unusable or has many test failuresarea-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).dart-model-analyzer-specIssues with the analyzer's implementation of the language specfeature-wildcard-variablesImplementation of the wildcard variables featuretriage-automationSee https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot.type-enhancementA request for a change that isn't a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions