-
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
analyzer does not report an error on incorrect code in strong mode #31858
Comments
I'm guessing that is a bug with instance-method (e.g., |
Commenting out the does cause the error to be reported in Slava's first example. Not sure that is quite the right fix though. |
@mraleph has a workaround: Fasta produces the errors he actually need to fix. |
I added this to our analyzer tracking bug (#31638) so we won't forget to work on it |
The strong mode semantics of that for both cases is an implicit downcast. That implicit downcast will in this case fail at runtime, but it is only in the toplevel case that the analyzer can prove that the downcast will definitely fail at runtime. In those cases, strong mode turns the downcast into a static error. |
So the question is if Slava's original example should a static error or a runtime error? |
@leafpetersen ah, implicit down casts. of course - FWIW this is extremely confusing and there are >30 incorrectly typed call-sites in Flutter due to this. Fixing this one call-site at a time would take us quite a bit of time. |
FYI, both DDC and DDK pass the following test:
Not sure there is anything actionable right now. @mraleph - there is |
To expand a bit:
Well, this is precisely what we're all signed up for in getting flutter working with the runtime checks enabled. This is why I've been banging that drum... :) But in any case, there's really no way around this - making it not a static error is ok, but that just pushes the error to runtime, and we really do need the runtime error (a My guess is that this is a case where the lack of I added support to the analyzer to run with |
A quick test suggest that the analyzer is supporting |
@leafpetersen we can't migrate Flutter to use
They use I am closing an issue because there is no bug in the analyzer (and both DDC and VM on CFE correctly report a runtime error). |
If I now move the code to top-level scope then analyzer reports an error
[Flutter is full of this sort of mistyped code (except they use
Null
instead ofString
) , so once this is fixed we would heed to do a pass over their code and fix it /cc @leafpetersen ]@devoncarew could you help triage this? Thanks.
The text was updated successfully, but these errors were encountered: