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

traits with self-types crash upon specialization #5071

Closed
scabug opened this issue Oct 11, 2011 · 3 comments
Closed

traits with self-types crash upon specialization #5071

scabug opened this issue Oct 11, 2011 · 3 comments
Assignees

Comments

@scabug
Copy link

scabug commented Oct 11, 2011

trait Foo[@specialized A, Repr] {
  self: Repr =>
}
trait Bar[A] extends Foo[A, Object] { }
error: scala.reflect.internal.Types$TypeError: illegal inheritance;
 self-type Foo$mcV$sp[Repr] does not conform to Foo[Unit,Repr]'s selftype Foo[Unit,Repr] with Repr
	at scala.tools.nsc.typechecker.Contexts$Context.error(Contexts.scala:283)
	at scala.tools.nsc.typechecker.Infer$Inferencer.error(Infer.scala:207)
	at scala.tools.nsc.typechecker.Typers$Typer.validateParentClass$1(Typers.scala:1293)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$validateParentClasses$1.apply(Typers.scala:1304)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$validateParentClasses$1.apply(Typers.scala:1304)
	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)

I tried fixing this by setting typeOfThis on the specialized classes to include the self type of the original class, but I didn't get anywhere. Suppressing the conformance check in Typers only moves the crash further downfield.

This issue prevents the specialization of e.g. LinearSeqOptimized.

@scabug
Copy link
Author

scabug commented Oct 11, 2011

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

@scabug
Copy link
Author

scabug commented Oct 11, 2011

@paulp said:
I take that back, I figured it out.

@scabug
Copy link
Author

scabug commented Oct 11, 2011

Commit Message Bot (anonymous) said:
(extempore in r25823) Propagate self-type to specialized subclasses.

Closes #5071, review by prokopec.

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