Skip to content
This repository was archived by the owner on Sep 1, 2020. It is now read-only.
This repository was archived by the owner on Sep 1, 2020. It is now read-only.

ValueOf interferes with implicit resolution of covariant typeclasses of singleton types #172

@sir-wabbit

Description

@sir-wabbit
trait Foo[+A]
implicit def foo[A <: Singleton](implicit v: ValueOf[A]): Foo[A] = new Foo[A] { }
val s = ""
implicitly[ValueOf[s.type]] // works
implicitly[Foo[s.type]] // doesn't work
trait Foo[+A]
implicit def foo[A <: Singleton]: Foo[A] = new Foo[A] { }
val s = ""
implicitly[Foo[s.type]] // works

If Foo is invariant, implicit resolution works. It is specific to ValueOf[A] as can be shown by:

trait Foo[+A]
trait Boo[A]
implicit def boo[A <: Singleton]: Boo[A] = new Boo[A] { }
implicit def foo[A <: Singleton](implicit v: Boo[A]): Foo[A] = new Foo[A] { }

val s = ""
implicitly[Foo[s.type]] // works fine

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions