sdk icon indicating copy to clipboard operation
sdk copied to clipboard

[Wildcard Variables] Analyzer Implementation

Open kallentu opened this issue 1 year ago • 1 comments

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

Work Items

  • [ ] AST enhancements (AstBuilder)
    • For both locals and parameters, distinguish between wildcard and regular declarations. Keep element for future use in areas like renaming.
  • [ ] Resolution of directives
    • May need some changing depending on https://github.com/dart-lang/language/issues/3799
  • [X] Element model
  • [X] Type system updates
  • [X] Summary support
    • Make sure still works as intended.
  • [ ] Resolution
    • [ ] ResolutionVisitor (resolve types)
    • [ ] ScopeResolverVisitor (resolve simple identifiers by scope)
      • Don't put wildcard variables in scope.
    • [ ] ResolverVisitor (type-based resolution)
  • [ ] Constant evaluation
    • Verify with some tests that constants still work as expected with wildcards.
  • [X] Index and search
  • [ ] Warnings (annotation-based, unused*, strict-mode-based, a few others)
    • [ ] InheritanceOverrideVerifier (report errors and warnings related to overrides)
      • Make sure we can override methods and use _ for unused parameters.
    • [ ] ErrorVerifier (report other errors and warnings)
      • From #initializing-formals, “Even though the parameters no longer collide, it is still an error to have two initializing formals named _
      • From #super-parameters, “An occurrence of super._ as a declaration of a formal parameter in a constructor is a compile-time error.”
      • [ ] #55905
        • Discussion: https://github.com/dart-lang/language/issues/3798
      • [ ] #55920
      • [x] #56089
      • [x] #56092
    • [X] FfiVerifier (report errors and warnings related to FFI)
    • [ ] Unused elements warnings
      • [x] UNUSED_ELEMENT
        • [x] https://github.com/dart-lang/sdk/commit/f517dd6436fb6a14e52b10e04f20fe32b75433ee
      • [ ] UNUSED_LOCAL_VARIABLE
        • [ ] https://github.com/dart-lang/sdk/issues/55719
      • [ ] UNUSED_CATCH_CLAUSE
        • [ ] #55723
      • [x] UNUSED_CATCH_STACK
        • [x] https://github.com/dart-lang/sdk/issues/55721
      • [x] UNUSED_FIELD
        • [x] #55862
    • [x] Dead code
    • [x] @useResult verification should not warn on results assigned to wildcards: https://github.com/dart-lang/sdk/commit/a86ec25ffb90cbbe389ea6c4a22f33248deb70d0
  • [X] ExitDetector
  • [X] NodeLintRegistry

kallentu avatar May 09 '24 22:05 kallentu

@pq I updated what needs to be done in the analyzer with a short note from the kickoff. If it's easier to track with singular issues, we can do that too.

I suspect this work can start soon. I'm currently slowly adding language tests to the repo and I usually use those as a good indicator of what's working and what isn't.

kallentu avatar May 13 '24 22:05 kallentu

@kallentu:

From #super-parameters, “An occurrence of super._ as a declaration of a formal parameter in a constructor is a compile-time error.”

This seems out of sync with the current spec. Could you take a look?

pq avatar Jul 15 '24 20:07 pq

@kallentu:

From #super-parameters, “An occurrence of super._ as a declaration of a formal parameter in a constructor is a compile-time error.”

This seems out of sync with the current spec. Could you take a look?

Ah yes, you're right. I updated the task, feel free to remove it or change it. super._ isn't a compile time error.

kallentu avatar Jul 24 '24 19:07 kallentu

Marking this as done for the most part. Feature has shipped.

kallentu avatar Feb 12 '25 16:02 kallentu