New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicit infer failed for diverging in case of materialization and generic with covariance #10224

scabug opened this Issue Mar 13, 2017 · 1 comment


None yet
1 participant
Copy link

scabug commented Mar 13, 2017

Simplified situation:
class Gen[+A] //mark1

class Simple1
class Simple2
class Complex

object TestDMCreationContext extends App {
implicit def gen[E](implicit e: E, classTag: scala.reflect.ClassTag[E]): Gen[E] = new Gen[E] //mark2
implicit def c1: Simple1 = new Simple1
implicit def c2: Simple2 = new Simple2 //mark3
implicit def c3(implicit g: Gen[Simple1]): Complex = new Complex


The error:
Test.scala:13: error: diverging implicit expansion for type Complex
starting with method c3 in object TestDMCreationContext
one error found

When the code with mark1 is changed to: class Gen[A]
or the code with mark2 is changed to implicit def gen[E](implicit e: E): Gen[E] = new Gen[E]
or the code with mark3 is deleted, the compilation successes.

I think this is the bug about materialization


This comment has been minimized.

Copy link

scabug commented Mar 13, 2017

Imported From:
Reporter: Franklin Zhang (chigou79)

@scabug scabug added the typer label Apr 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment