-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't implicit errors if parameters has default value
If implicit parameters have default values then we try to re-type the application with default values supplied as arguments. So far we fell back to the original errors if retyping failed, which can lead to confusing error messages. We now stick with the retyping in all cases. Fixes #14842
- Loading branch information
Showing
3 changed files
with
23 additions
and
8 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,7 @@ | ||
-- [E007] Type Mismatch Error: tests/neg/i14842.scala:11:35 ------------------------------------------------------------ | ||
11 | val x: Either[Int, Any] = node.as[Any] // error | ||
| ^^^^^^^^^^^^ | ||
| Found: Either[String, Any] | ||
| Required: Either[Int, Any] | ||
| | ||
| longer explanation available when compiling with `-explain` |
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 Dummy | ||
object Dummy: | ||
val empty = new Dummy | ||
|
||
sealed trait Node: | ||
def as[T](using d: Dummy = Dummy.empty): Either[String, T] = ??? | ||
|
||
object Sample extends App { | ||
val node: Node = ??? | ||
|
||
val x: Either[Int, Any] = node.as[Any] // error | ||
} |