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 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

This comment has been minimized.

Copy link
Author

@scabug scabug commented Oct 11, 2011

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Oct 11, 2011

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

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Oct 11, 2011

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

Closes #5071, review by prokopec.

@scabug scabug closed this Oct 11, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.