Skip to content

Conversation

@noti0na1
Copy link
Member

@noti0na1 noti0na1 commented Dec 11, 2025

The callee part is separated from #24697 for further investigation

When typing a function literal's expression to infer the callee type, we now create placeholder tree for each argument, and make sure the function part does not refer to any parameter. This ensures that references in the expression won't incorrectly resolve to outer scope variables with the same names as the parameters.

Fix the following test:

def foo[T <: (B => Unit)](f: T) = ???
def transfer(in: A): Unit =
  foo(in => transfer(in)) // error: Found: (in : B) Required: A
def transfer(in: B): Unit = ???

Copilot AI review requested due to automatic review settings December 11, 2025 15:02

This comment was marked as outdated.

@noti0na1
Copy link
Member Author

The last commit contains the stricter rule we discussed yesterday, but it breaks type inference in several tests. @odersky

This one will bring back previously fixed regressions that have to be looked at separately.
@odersky odersky force-pushed the fix-callee-type-inference branch from 9b730ab to 8671e84 Compare December 12, 2025 09:55
@odersky
Copy link
Contributor

odersky commented Dec 12, 2025

I fixed calleetype so that all tests pass, except for three tests that tested recent regressions. We should look separately into these. They probably need another fix.

@noti0na1
Copy link
Member Author

I fixed calleetype so that all tests pass, except for three tests that tested recent regressions. We should look separately into these. They probably need another fix.

The remaining errors should be fixed after we merge #24697

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants