givens synthesis question #25922
-
|
hello folks, i don't really know right words to describe this behavior, but i will try my best, having such code(https://scastie.scala-lang.org/bcGe9yspStSHqXfdsplVMQ): trait EqProxy[A, B]
object EqProxy {
given [A, B](using A =:= B): EqProxy[Option[A], B] = new EqProxy {}
}
summon[EqProxy[Option[String], String]]
summon[EqProxy[Option[String], Int]]first summon compiles, second one doesn't(i expected both to not compile) Are there any docs on this behavior, or maybe there's a better well explained underlying mechanism that does this and not what I imagine? Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
So Your result happens to implicate Edit: I see maybe you think your type args to |
Beta Was this translation helpful? Give feedback.
-Vprint:typeror-Vprint:inliningtells you what it did.So
AandBare bothString.Your result happens to implicate
Option[A], and you expect a result inOption[String], so that aligns.Edit: I see maybe you think your type args to
summonare the args to your given def, so-Vprintclears that up.