Skip to content

pin return type from downwards inference #27933

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
jmesserly opened this issue Nov 30, 2016 · 2 comments
Closed

pin return type from downwards inference #27933

jmesserly opened this issue Nov 30, 2016 · 2 comments
Assignees
Labels
legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@jmesserly
Copy link

along the lines of #27917, it would be nice if downwards inference required the return type to be exactly the context type, rather than a strong type.

I attempted to implement this (it is a trivial one line change after https://codereview.chromium.org/2456803004 lands) however it causes inference failures in some packages like stack_trace and unittest, not to mention in DDC and Analyzer code bases themselves. Because of that, it may be best to roll out independently of the above patch.

@jmesserly
Copy link
Author

jmesserly commented Nov 30, 2016

One common issue: the return type is weaker than the type parameter bound. That's a guaranteed inference failure with this change. We had some in our own code, for example T extends ParameterizedType but we assign the resulting T to a DartType variable.

@bwilkerson bwilkerson added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Nov 30, 2016
@jmesserly
Copy link
Author

My 1-line approach above doesn't work. I'm going to explore a different approach. We'll remember the type variables we solved for in the downwards phase, that did not contain ?, and make sure those are not inferred at all for the upwards phase.

@jmesserly jmesserly self-assigned this Jan 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

2 participants