-
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
Remove unsafe implicit cast warnings in Flutter code base #28588
Comments
If these warnings are only needed because we don't do the correct runtime strong mode checks, we should think about what state we want this to be in for 1.23. |
We believe we can get rid of this warning and turn it into a lint that users can enable if they want help finding areas where runtime checks might fail for them. |
We have reached the decision to turn off the It looks like analysis options are dealt with in a lot of places in the analyzer code base, @pq? It feels hard to manipulate the options map and add the ignore there, so here's a suggestion on how to turn this off for Flutter projects by passing down the Do you have cycles to look at this, Phil, and figure out what the best path forward is? |
👍 Happy to take a look. |
Turned the warning into a hint in fa2a3a1, but had to revert it. |
Finally landed turning this into a lint in 2fe8485. |
@kasperl are you still working on this? |
@mit-mit The work is done, but it hasn't been rolled into Flutter yet. We could turn this into a Flutter issue blocked on rolling the Dart SDK dependency past the next dev channel release -- and close this one. That's probably the best approach. |
@mit-mit This change will be in 1.23.0-dev.6.0. Will go ahead and close this issue. |
Filed flutter/flutter#8783. Closing this one. |
What was the final resolution of this? I don't see it surfacing as a hint. Is it now an opt in lint? If so, what are the instructions for enabling it? |
I believe it's now only shown if you have strong warnings enabled. I'm not sure how that gets done though! (Not seeing an option in cc @bwilkerson who may know |
If by strong warnings, you mean AnalysisOptionsImpl.strongModeHints, I think that's only available programmatically, and is really more of a testing feature for us at this point. |
I think that's right -- and was under the impression that was the desired approach... I'll leave it to @kasperl to clarify though! |
Ok. For context, I'm writing the changelog, and I want to know what to say about this. That is, should I be saying "this is gone" or "this is now opt in via path XXX", or... |
You can opt in through an analysis options file - explicitly requesting to
turn the specific hint into a warning or an error.
…On Tue, Mar 28, 2017, 22:45 Leaf Petersen ***@***.***> wrote:
Ok. For context, I'm writing the changelog, and I want to know what to say
about this. That is, should I be saying "this is gone" or "this is now opt
in via path XXX", or...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#28588 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACDmpq8UC-IJjR-a4DdiOmCKi5CP4op3ks5rqXFYgaJpZM4LzjG7>
.
|
Can you elaborate more? I've not been able to surface this in any way, even as a hint. Adding
to an analysis options file still doesn't surface it in any way that I can see. |
Ack, @leafpetersen. I've messed this up. The strong mode checker filters out hints aggressively without consulting the analysis options. |
Is there any more info on the reasons for this decision? To me it seems really strange that "opting in to strong mode" would not give you protection against this by default. A colleague asked me today why his |
The Flutter analysis options currently contain:
strong_mode_down_cast_composite: ignore
Enabling those warnings leads to >100 warnings in the Flutter code base like these:
I suspect that a lot of these will require changes to the Flutter code base, but we should make sure that the type system isn't making this unnecessarily hard.
Reproduction steps:
The text was updated successfully, but these errors were encountered: