-
Notifications
You must be signed in to change notification settings - Fork 30
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
analysis issues when compiled with ddc #1612
Comments
This is for |
This looks to be caused by dart-archive/dev_compiler#31. |
yeah still investigating. Type promotion does seem to be working in DDC. I think this our inference exposing the fact that type promotion doesn't work for the pattern You can see in the |
maybe someone like @bwilkerson could confirm, but from reading the Dart spec, it seems that type promotion does not work in this case:
on VM it prints "S" but analyzer gives:
also CC @vsmenon, @leafpetersen ... we should certainly consider improving type promotion in DDC mode, though. I wonder if propagatedType currently does anything smarter in analyzer. |
How is it that this code doesn't produce a warning in the analyzer without |
Correct. The specification does not allow for promoting anything based on an
Yes. The propagated type of
What warning are you expecting (or what does strong mode report)? My guess is that strong mode produces a warning because it infers a type in a place where the specification defines the type to be "dynamic". Because it replaces the specification's notion of the static type of an expression with a stronger version, it produces a warning as if you had explicitly declared the inferred type. |
yeah, @vsmenon and @leafpetersen and I just looked over this. We conclude that inference is the culprit. The code in that class is very interesting, contrast the compareTo method above, and the operator== method after: each tells a different story.
|
fyi, I opened dart-archive/dev_compiler#274 to improve type promotion in DDC mode, but I suspect it will be a while before we get there. Unless there's a clever way of hooking up this in strong mode:
@bwilkerson off hand do you know what class computes that in analyzer? StaticTypeAnalyzer? |
The logic is in ResolverVisitor.visitIfStatement. |
I see two analysis issues when this package is compiled with ddc:
The text was updated successfully, but these errors were encountered: