Closed
Description
Compiler version
3.0.0
Minimized code
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 = ???
// the following compiles just fine
Encoder(new Placeholder[varchar, String])("hello")
// the following fails
Encoder(Placeholder[varchar])("hello")
Output
Found: ("hello" : String)
Required: Nothing
Encoder(Placeholder[varchar])("hello")
Expectation
It should have compiled just fine