Skip to content

Implicit conversion fails with literal types #3781

@soronpo

Description

@soronpo
  class Foo[T](val value : T) 
  object Foo {
    implicit def fromXInt[T <: Int with Singleton](i : T): Foo[T] = new Foo[T](i)
  }
  class FooUser[T] {
    def op[T2](that : Foo[T2]) : FooUser[T2] = new FooUser[T2]
  }
  val f = new FooUser[1]
  val f2 = f op 2
12 |  val f2 = f op 2
   |                ^
   |                found:    Int(2)
   |                required: Test.Foo[T2]
   |                
   |                where:    T2 is a type variable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions