diff --git a/tests/pos/i12910.scala b/tests/pos/i12910.scala new file mode 100644 index 000000000000..e78408aa5e5f --- /dev/null +++ b/tests/pos/i12910.scala @@ -0,0 +1,27 @@ +trait Type[T]: + type Out + +type varchar + +given Type[varchar] with + type Out = String + +class Placeholder[T, U] + +object Placeholder: + def apply[T](using t: Type[T]): Placeholder[T, t.Out] = new Placeholder + +trait Encoder[P, X]: + def encode(x: X): String + +object Encoder: + def apply[P, X](placeholder: P)(using e: Encoder[P, X]): X => String = e.encode + + given [T, X]: Encoder[Placeholder[T, X], X] with + def encode(x: X): String = ??? + +def Test = + // the following compiles just fine + Encoder(new Placeholder[varchar, String])("hello") + // the following fails + Encoder(Placeholder[varchar])("hello")