-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle context function arguments in overloading resolution
Fixes #16506 We now handle the cases where an argument of an overloaded method is a context closure. The closure must be given implicitly. It cannot be inferred since at the time where the argument is typed, there is no expected expected type to expand it to a context closure.
- Loading branch information
Showing
3 changed files
with
26 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import scala.annotation.targetName | ||
|
||
trait Ctx | ||
|
||
def foo(f: Ctx => Int) = ??? | ||
|
||
@targetName("fooContextual") | ||
def foo(f: Ctx ?=> Int) = ??? | ||
|
||
def bar1 = foo(ctx => 123) | ||
def bar2 = foo((ctx: Ctx) => 123) | ||
def bar3 = foo(ctx ?=> 123) | ||
def bar4 = foo((ctx: Ctx) ?=> 123) | ||
// def bar5 = foo(123) does not work |