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

AnyRef specialization in class plus method causes type mismatch compiler crash #4770

Closed
scabug opened this issue Jul 5, 2011 · 5 comments
Closed
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Jul 5, 2011

This crashes the compiler.

package crasher {
  class Z[@specialized A, @specialized(AnyRef) B](var a: A, var b: B) { }
  object O {
    def apply[@specialized A, @specialized(AnyRef) B](a0: A, b0: B) = 
      new Z(a0,b0)
  }
}

For the crash to occur, you need at least two specialized types, at least one has to be AnyRef, and there have to be at least two specialized types for at least one of the entries.

The compiler complains:

error: scala.tools.nsc.symtab.Types$TypeError: type mismatch;
 found   : B$sp(in method apply$mVTc$sp)
 required: B$sp(in class Z$mcVT$sp)
	at scala.tools.nsc.typechecker.Contexts$Context.error(Contexts.scala:291)
	at scala.tools.nsc.typechecker.Infer$Inferencer.error(Infer.scala:205)
	at scala.tools.nsc.typechecker.Infer$Inferencer.typeError(Infer.scala:215)
	at scala.tools.nsc.typechecker.Infer$Inferencer.typeErrorTree(Infer.scala:230)
	at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:929)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4219)
        ...
@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jul 5, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4770?orig=1
Reporter: @Ichoran
Affected Versions: 2.9.0, 2.9.1

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Feb 15, 2012

@paulp said:
bb23d766bc

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Feb 17, 2012

@paulp said:
Reopening, I didn't really fix this, it just stopped happening when I broke something else, and unbreaking that put this back the way it was.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Feb 19, 2012

@paulp said:
Fixed along with #5500, test in 87e369ef46 .

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Feb 23, 2012

@szeiger said:
Related Zendesk ticket: http://support.typesafe.com/tickets/1642

@scabug scabug closed this Jun 18, 2012
@scabug scabug added this to the 2.10.0 milestone Apr 7, 2017
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.