Skip to content

analyzer.language replacement for analyzer.strong-mode.implicit-dynamic #48651

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

Closed
DetachHead opened this issue Mar 23, 2022 · 4 comments
Closed
Labels
devexp-warning Issues with the analyzer's Warning codes legacy-area-analyzer Use area-devexp instead. P3 A lower priority bug or feature request

Comments

@DetachHead
Copy link

the strict-inference and strict-raw-types rules don't replace strong-mode.implicit-dynamic as they don't complain about implicit dynamics in function arguments:

void foo(a) {}

when implicit-dynamic is enabled:

error • lib\a\a.dart:1:10 • Missing parameter type for 'a'. Try adding an explicit type, or remove implicit-dynamic from your analysis options file. • implicit_dynamic_parameter

see #48650 (comment)

@bwilkerson
Copy link
Member

@srawlins

@parlough
Copy link
Member

It seems that it will work if you reference the parameter in the body, but the spec for the mode explicitly excludes parameters not referenced. @srawlins can perhaps provide more context around that decision.

A parameter of a non-abstract function, which is declared without a type, and which is not referenced from inside the function body does not contain an inference failure.

@a-siva a-siva added the legacy-area-analyzer Use area-devexp instead. label Mar 23, 2022
@scheglov scheglov added the P3 A lower priority bug or feature request label Mar 23, 2022
@srawlins
Copy link
Member

I think it's not an inference failure because there is no situation in which the parameter type is inferred. It just doesn't enter the equation. I definitely understand that it seems like if var foo; is reported, then so should void f(foo) {}.

Not sure if there is a lint rule which guards against untyped parameters, but type_annotate_public_apis gets you part way.

@srawlins srawlins added the devexp-warning Issues with the analyzer's Warning codes label Mar 23, 2022
@DetachHead
Copy link
Author

ah i see, thanks! as long as the warning shows up when it's used i'm happy with that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devexp-warning Issues with the analyzer's Warning codes legacy-area-analyzer Use area-devexp instead. P3 A lower priority bug or feature request
Projects
None yet
Development

No branches or pull requests

6 participants