-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Strong mode differs based on how it's enabled #26129
Comments
Crazy! Probably picking up different SDKs? (aside: not sure if it was intended, but in that example the generic method "T" shadows the class "T" ... we should probably be issuing an error for that, but might not be implemented) |
That is intended; I'd expect it not to be a problem, since it's a static method. |
Ah, right! Yeah, should be fine in that case. (There used to be an analyzer warning disallowing any type parameters in static methods, I think I fixed it to only disallow the class's type parameters...) |
I don't think it should be a problem to shadow a type variable in a non-static method either. Shadowing is allowed for all other names. |
@bwilkerson @pq Any chance either of you could spare a few cycles to try to track this down? It's small but insidious. It looks like something with the way that analyzer options are getting propagated from command line vs .analysis_options. Maybe not getting copied in somewhere when set from the .analysis_options file? |
@leafpetersen : I can repro this and have a breakpoint set in the debugger but don't quite know what to make of what I'm seeing... Maybe we can take a look tomorrow? |
Running this again today I'm seeing different results in the CLI.
The basic issue is that we're not properly propagating |
@pq That new error is what you get when you analyze strong mode code against a non-strong mode SDK. Basically the declaration (I think Future.then here?) has been analyzed ignoring generic methods, and now in your application at the call site a generic parameter is being passed. |
The latest dev build has stable summaries so we should start using them. (Also ensures that analysis options are propogating to the SDK analysis context --- see: dart-lang/sdk#26129.)
I have the following file called
test.dart
:If I run
dartanalyzer test.dart
with no.analysis_options
file, or if I rundartanalyzer --strong test.dart
with or without an.analysis_options
file, it prints no errors. However, if I create the following.analysis_options
file:and I run
dartanalyzer test.dart
(without--strong
), it prints the following error:The text was updated successfully, but these errors were encountered: