Skip to content

Type inference failure with dependent types and type classes (Nothing was inferred) #12910

@epifab

Description

@epifab

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions