Improve type inference of function calls by propagating expectations#1317
Improve type inference of function calls by propagating expectations#1317
Conversation
|
@phischu if you still remember the original problem that inspired the issue, does this fix solve it? |
| expectedCallHint match { | ||
| case Some((arity, retTpe)) => | ||
| val freshVps = List.fill(arity) { | ||
| ValueTypeRef(Context.freshTypeVar(TypeParam(Name.local("_")), u)) |
There was a problem hiding this comment.
I'm still a bit worried about this _ leaking (again), I'm trying to fake "just enough" block unification to get by here...
There was a problem hiding this comment.
In a way, the unexpected error message is better, but I don't want to have ad-hoc "anything fits here" type variables without them having some reasonable semantics a la #276.
4081307 to
71e5cf7
Compare
|
No, this does not fix #1224. The following type checks: But in the following: I get:
What I would want is
So we are forgetting to do index unification in matches or something. |
|
Yeah, I know it doesn't fix #1224, I was just trying to improve the inference when you annotate at least something. But good point, I can take a look at the trace again and see if I can come up with some other trick — the issue here is that we never unify block types... (so we would derive the |
|
No need to fix #1224, I misunderstood. I am the wrong person to review this, but I'll just approve anyway. |

Improves the error message of #1224 by propagating more information for boxed functions whenever possible, specifically when we know the expected type of the call, but were previously too shy to try and apply it: