-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Type resolution should use the downwards inference type #30542
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
Comments
cc @stereotype441 @jmesserly who have been discussing cast placement in kernel |
yeah that seems like an oversight. Cascades should definitely be getting the context pushed down to the target. Especially since it's a common initialization pattern, which exactly when the context type is most useful . |
FYI @leafpetersen -- I also noticed |
Yes, I never got a change to go through the language grammar and exhaustively make sure that we were using all of the contexts that were available, so I'm sure we're still missing a number of them. :( |
I think front_end already handles cascades correctly, but I'll double check. @jmesserly, regarding |
@stereotype441 -- yeah, I owe you that CL. It's caught up in one of my many outstanding DDC perf CL's, I'll try to disentangle that so I can send it out. |
I think this is a duplicate of #31792 |
ah that one is for CFE; will reopen. I think you're looking at Analyzer though Leaf? |
No more errors on this code. |
This code results in a no such method error on the call to
bar
ongetBar()
:We seem to be correctly using a downwards inference context to fill in types in cascades, but resolution doesn't mark
getBar()
as having typeFoo
, with the associated implicit cast placed around thegetFoo()
call directly. As a result, we provide poor completion results.In general, this applies to all composite structures like list literals, conditional expressions, etc. We will give better completion results and better user error checking if we push the type inwards.
The text was updated successfully, but these errors were encountered: