Skip to content

Implicit resolution error in REPR #8

@limansky

Description

@limansky

I've found that I got compilation error in REPR when the splain plugin is enabled:

scala> import shapeless._, me.limansky._, cats.instances.all._
import shapeless._
import me.limansky._
import cats.instances.all._

scala> case class Foo(n: Int); case class Bar(s: String, f: Foo)
defined class Foo
defined class Bar

scala> MapReader[Bar].read(Map("s" -> "b", "n" -> "6"))
<console>:25: error: implicit error;
!I ev: MapReader[Bar]
MapReader.genericReader invalid because
!I mapReader: MapReader[R]
Generic.materialize invalid because
type parameters weren't correctly instantiated outside of the implicit tree: inferred type arguments [shapeless.::[String,shapeless.::[Foo,shapeless.HNil]],Nothing] do not conform to method materializeCoproduct's type parameter bounds [V <: shapeless.Coproduct,R <: shapeless.Coproduct]
       MapReader[Bar].read(Map("s" -> "b", "n" -> "6"))

The same code without plugin works fine:

scala> import shapeless._, me.limansky._
import shapeless._
import me.limansky._

scala> import shapeless._, me.limansky._, cats.instances.all._
import shapeless._
import me.limansky._
import cats.instances.all._

scala> case class Foo(n: Int); case class Bar(s: String, f: Foo)
defined class Foo
defined class Bar

scala> MapReader[Bar].read(Map("s" -> "b", "n" -> "6"))
res0: Bar = Bar(b,Foo(6))

The code is available in this gist: https://gist.github.com/limansky/7c91a3deaa25fc0ec7339ea191d4a54a

It looks like the problem is reproducible only in REPR, at least the tests are compiled and passed successfully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions