Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dot Shorthands] Analyzer Implementation #59835

Open
8 tasks
Tracked by #57036
kallentu opened this issue Jan 2, 2025 · 0 comments
Open
8 tasks
Tracked by #57036

[Dot Shorthands] Analyzer Implementation #59835

kallentu opened this issue Jan 2, 2025 · 0 comments
Assignees
Labels
analyzer-spec Issues with the analyzer's implementation of the language spec area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-dot-shorthands Implementation of the dot shorthands feature. P2 A bug or feature request we're likely to work on

Comments

@kallentu
Copy link
Member

kallentu commented Jan 2, 2025

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?)
  • NodeLintRegistry

    • If we make a new AST node representing enum shorthands, should add it to this.
@kallentu kallentu added analyzer-spec Issues with the analyzer's implementation of the language spec area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-dot-shorthands Implementation of the dot shorthands feature. P2 A bug or feature request we're likely to work on labels Jan 2, 2025
@kallentu kallentu self-assigned this Jan 2, 2025
@kallentu kallentu changed the title [Enum Shorthands] Analyzer Implementation [Dot Shorthands] Analyzer Implementation Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-spec Issues with the analyzer's implementation of the language spec area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-dot-shorthands Implementation of the dot shorthands feature. P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

1 participant