sdk
sdk copied to clipboard
[Wildcard Variables] Analyzer Implementation
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.
- Make sure we can override methods and use
- [ ]
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
- From #initializing-formals, “Even though the parameters no longer collide, it is still an error to have two initializing formals named
- [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]
- [x] Dead code
- [x] local function declarations: https://github.com/dart-lang/sdk/commit/a446cd96670bd461185ae58048ed02bb223468a1
- [x]
@useResultverification should not warn on results assigned to wildcards: https://github.com/dart-lang/sdk/commit/a86ec25ffb90cbbe389ea6c4a22f33248deb70d0
- [ ]
- [X] ExitDetector
- [X] NodeLintRegistry
@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:
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?
@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.
Marking this as done for the most part. Feature has shipped.