forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Draft: Overloading result-based pruning shouldn't prefer inapplicable…
… alt If an overloaded alternative in `alts` does not end up being part of the `candidate` list in `resolveOverloaded1`, then it is not applicable to the current arguments and should not be considered by `adaptByResult`. This avoids discarding working solutions in favor of invalid ones when the working solution involves a match type in the method result type that will fail `resultConforms`. Fixes scala#21410.
- Loading branch information
Showing
2 changed files
with
30 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class A | ||
object Test: | ||
type F[X] <: Any = X match | ||
case A => Int | ||
|
||
def foo[T](x: String): T = ??? | ||
def foo[U](x: U): F[U] = ??? | ||
|
||
val x1 = foo(A()) | ||
val y: Int = x1 | ||
|
||
val x2: Int = foo(A()) // error |