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

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.

2 participants