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

Open
scabug opened this Issue Mar 13, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@scabug
Copy link

scabug commented Mar 13, 2017

Simplified situation:
{code:title=Test.scala|borderStyle=solid}
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

implicitly[Complex]
}
{code}

The error:
Test.scala:13: error: diverging implicit expansion for type Complex
starting with method c3 in object TestDMCreationContext
implicitly[Complex]
^
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

@scabug

This comment has been minimized.

Copy link

scabug commented Mar 13, 2017

Imported From: https://issues.scala-lang.org/browse/SI-10224?orig=1
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