Skip to content

[Dot Shorthands] Analyzer Implementation #59835

Closed
1 of 1 issue completed
Closed
1 of 1 issue completed
@kallentu

Description

@kallentu

This meta issue tracks all the analyzer implementation work items. Referenced from: https://github.com/dart-lang/sdk/blob/main/pkg/analyzer/doc/process/new_language_feature.md

Estimated work

  • Parser

    • Need changes to identify when we have a shorthand, add all selectors
    • Recovery/error when . followed by a keyword?, some random symbol
    • Expressions can’t start with .
  • AST enhancements (AstBuilder)

    • New AST type to represent the enum shorthand
    • . operator
    • And then the rest of the expression
    • Based on Paul’s prototype we need to represent a non-existent target (which he does with a “MAGIC” SimpleIdentifier)
  • Summary support

    • Summaries record constants so I might need to do work here? Check with Konstantin
  • Resolution

    • ResolverVisitor (type-based resolution)
      • Paul’s prototype used a stack of type schemas (named _enumShorthands). “When the ResolverVisitor enters the enum shorthand context node, it pushes the context onto this stack; when it leaves it, it pops it back off”
      • Work needed, tests needed.
      • == work in the TypeAnalyzer as well.
  • Constant evaluation

    • We allow consts for enum shorthands.
    • Use the new AST.
    • Tests
  • Index and search

    • Not entirely sure?
    • We can refer to a class without naming it. Might need updating?
  • Warnings (annotation-based, unused*, strict-mode-based, a few others)

    • ErrorVerifier (report other errors and warnings)
      • Error when we are missing the context type
      • Error with asymmetric == and != (These errors might just belong in the ResolverVisitor?)
      • From @FMorschel : Check Ambiguous Import to make sure it triggers correctly for this case too.
  • NodeLintRegistry

    • If we make a new AST node representing enum shorthands, should add it to this.

Sub-issues

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onarea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.feature-dot-shorthandsImplementation of the dot shorthands feature.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions