Skip to content
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

unresolved type constructor during implicit resolution: crash #5845

Closed
scabug opened this issue May 28, 2012 · 6 comments
Closed

unresolved type constructor during implicit resolution: crash #5845

scabug opened this issue May 28, 2012 · 6 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented May 28, 2012

The error message is similar to #4365, but this is not code or file order dependent that I have determined.

class Num[T] {
  def mkOps = new Ops
  class Ops { def +++(rhs: T) = () }
}

class A {
  implicit def infixOps[T, CC[X] <: Num[X]](lhs: T)(implicit num: CC[T]) = num.mkOps
  implicit val n1 = new Num[Int] { }
  println(5 +++ 5)
}
T in class Num cannot be instantiated from ?CC
	at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:43)
	at scala.tools.nsc.Global.abort(Global.scala:225)
	at scala.reflect.internal.Types$AsSeenFromMap.throwError$1(Types.scala:4318)
	at scala.reflect.internal.Types$AsSeenFromMap.toInstance$1(Types.scala:4372)
	at scala.reflect.internal.Types$AsSeenFromMap.apply(Types.scala:4376)
	at scala.reflect.internal.Types$TypeMap$$anonfun$noChangeToSymbols$2.apply(Types.scala:4011)
	at scala.reflect.internal.Types$TypeMap$$anonfun$noChangeToSymbols$2.apply(Types.scala:4011)
	at scala.collection.LinearSeqOptimized$class.forall(LinearSeqOptimized.scala:69)
@scabug
Copy link
Author

scabug commented May 28, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5845?orig=1
Reporter: @paulp
Other Milestones: 2.10.0

@scabug
Copy link
Author

scabug commented May 28, 2012

@retronym said:
Fixing the crash is easy enough; getting the inference to work for a view is harder:

retronym/scala@82fb9a7

@scabug
Copy link
Author

scabug commented May 28, 2012

@retronym said:
This version works well (even in 2.9.x with -Ydependent-method-types).

class Num[T] {
  def mkOps = new Ops
  class Ops { def +++(rhs: T) = () }
}

class A {
  implicit def infixOps[T](lhs: T)(implicit num: Num[T]): num.Ops = num.mkOps
  implicit val n1: Num[Int] = new Num[Int] { }
  5 +++ 5
}

@scabug
Copy link
Author

scabug commented May 28, 2012

@retronym said:
scala/scala#636

@scabug scabug closed this as completed May 28, 2012
@scabug
Copy link
Author

scabug commented Jul 20, 2012

@odersky said:
The fix for #4881 fixes the inference for this one also.

@scabug
Copy link
Author

scabug commented Jul 20, 2012

@odersky said:
Correction: It fixes it in one of the two failing cases.

@scabug scabug added this to the 2.10.0-M3 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants