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.
Bring back ambiguity filter when report implicit not found
This reverts one part of scala#20261. When we fail with both an ambiguity on one implicit argument and another error on another we prefer the other error. I added a comment why this is needed. Fixes scala#20354
- Loading branch information
Showing
2 changed files
with
48 additions
and
1 deletion.
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,40 @@ | ||
trait CmdLineParser { outer => | ||
|
||
trait Opt[+T] { | ||
val default: T | ||
val names: Set[String] | ||
val help: String | ||
} | ||
|
||
trait IntOpt extends Opt[Int] { | ||
val parser = outer // <=== comment out this line, we get "true true" | ||
} | ||
} | ||
|
||
object FirstParser extends CmdLineParser { | ||
object OptMinSuccess extends IntOpt { | ||
val default = 100 | ||
val names = Set("bla") | ||
val help = "bla" | ||
} | ||
|
||
val opts = List(OptMinSuccess) | ||
} | ||
|
||
object SecondParser extends CmdLineParser { | ||
object OptMinSuccess extends IntOpt { | ||
val default = 50 | ||
val names = Set("bla") | ||
val help = "help" | ||
} | ||
} | ||
@main def Test = | ||
|
||
val a = SecondParser.OptMinSuccess.isInstanceOf[FirstParser.IntOpt] | ||
|
||
println(a) | ||
|
||
(SecondParser.OptMinSuccess: SecondParser.IntOpt) match { | ||
case _: FirstParser.IntOpt => println("true") | ||
case _ => println("false") | ||
} |