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

Adding @specialized annotation crashes the compiler. #6301

Closed
scabug opened this issue Aug 31, 2012 · 7 comments
Closed

Adding @specialized annotation crashes the compiler. #6301

scabug opened this issue Aug 31, 2012 · 7 comments

Comments

@scabug
Copy link

@scabug scabug commented Aug 31, 2012

Unfortunately I haven't been able to minimize the problem from my encounter with it in the wild.

Steps to reproduce:

hg clone https://bitbucket.org/scottmorrison/toolkit
hg update -r f7cf0edfbd7c
./sbt compile
# works fine!
hg update -r 16af6ffa2750
./sbt compile
# crashes the compiler!

The difference is a single specialization annotation, per https://bitbucket.org/scottmorrison/toolkit/compare/16af6ffa2750..f7cf0edfbd7c.

The compiler error message is

[error] uncaught exception during compilation: scala.MatchError
[error] {file:/Users/scott/projects/toolkit/}toolkit-algebra/compile:compile: scala.MatchError: (xs: collection.GenIterable)Int <and> (x0: Int, x1: Seq)Int <and> (x: Int, y: Int)Int (of class scala.reflect.internal.Types$OverloadedType)

and the output from last in sbt is

[error] uncaught exception during compilation: scala.MatchError
scala.MatchError: (xs: collection.GenIterable)Int <and> (x0: Int, x1: Seq)Int <and> (x: Int, y: Int)Int (of class scala.reflect.internal.Types$OverloadedType)
	at scala.tools.nsc.transform.CleanUp$CleanUpTransformer.transformApplyDynamic(CleanUp.scala:444)
	at scala.tools.nsc.transform.CleanUp$CleanUpTransformer.transform(CleanUp.scala:525)
	at scala.tools.nsc.transform.CleanUp$CleanUpTransformer.transform(CleanUp.scala:25)
	at scala.reflect.api.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:659)
	at scala.reflect.api.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:659)
	at scala.collection.immutable.List.loop$1(List.scala:164)
	at scala.collection.immutable.List.mapConserve(List.scala:180)
	at scala.reflect.api.Trees$Transformer.transformTrees(Trees.scala:659)
	at scala.reflect.internal.Trees$class.itransform(Trees.scala:1160)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:656)
	at scala.tools.nsc.transform.CleanUp$CleanUpTransformer.transform(CleanUp.scala:692)
	at scala.tools.nsc.transform.CleanUp$CleanUpTransformer.transform(CleanUp.scala:25)
	at scala.reflect.api.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:659)
	at scala.reflect.api.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:659)
	at scala.collection.immutable.List.loop$1(List.scala:164)
	at scala.collection.immutable.List.mapConserve(List.scala:180)
	at scala.reflect.api.Trees$Transformer.transformTrees(Trees.scala:659)
	at scala.reflect.internal.Trees$class.itransform(Trees.scala:1160)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:656)
	at scala.tools.nsc.transform.CleanUp$CleanUpTransformer.transform(CleanUp.scala:692)
	at scala.tools.nsc.transform.CleanUp$CleanUpTransformer.transform(CleanUp.scala:25)
	at scala.reflect.internal.Trees$$anonfun$itransform$2.apply(Trees.scala:1176)
	at scala.reflect.internal.Trees$$anonfun$itransform$2.apply(Trees.scala:1174)
	at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:684)
	at scala.reflect.internal.Trees$class.itransform(Trees.scala:1173)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:656)
	at scala.tools.nsc.transform.CleanUp$CleanUpTransformer.transform(CleanUp.scala:692)
	at scala.tools.nsc.transform.CleanUp$CleanUpTransformer.transform(CleanUp.scala:25)
	at scala.reflect.api.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:659)
	at scala.reflect.api.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:659)
	at scala.collection.immutable.List.loop$1(List.scala:164)
	at scala.collection.immutable.List.mapConserve(List.scala:180)
	at scala.reflect.api.Trees$Transformer.transformTrees(Trees.scala:659)
	at scala.tools.nsc.transform.CleanUp$CleanUpTransformer.scala$tools$nsc$transform$CleanUp$CleanUpTransformer$$transformTemplate(CleanUp.scala:54)
	at scala.tools.nsc.transform.CleanUp$CleanUpTransformer.transform(CleanUp.scala:538)
	at scala.tools.nsc.transform.CleanUp$CleanUpTransformer.transform(CleanUp.scala:25)
	at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:661)
	at scala.reflect.internal.Trees$$anonfun$itransform$4.apply(Trees.scala:1221)
	at scala.reflect.internal.Trees$$anonfun$itransform$4.apply(Trees.scala:1220)
	at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:684)
	at scala.reflect.internal.Trees$class.itransform(Trees.scala:1219)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:656)
	at scala.tools.nsc.transform.CleanUp$CleanUpTransformer.transform(CleanUp.scala:692)
	at scala.tools.nsc.transform.CleanUp$CleanUpTransformer.transform(CleanUp.scala:25)
	at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:677)
	at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:675)
	at scala.collection.immutable.List.loop$1(List.scala:164)
	at scala.collection.immutable.List.mapConserve(List.scala:180)
	at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:675)
	at scala.tools.nsc.transform.CleanUp$CleanUpTransformer.transformStats(CleanUp.scala:793)
	at scala.tools.nsc.transform.CleanUp$CleanUpTransformer.transformStats(CleanUp.scala:25)
	at scala.reflect.internal.Trees$$anonfun$itransform$7.apply(Trees.scala:1239)
	at scala.reflect.internal.Trees$$anonfun$itransform$7.apply(Trees.scala:1239)
	at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:684)
	at scala.reflect.internal.Trees$class.itransform(Trees.scala:1238)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
	at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
	at scala.reflect.api.Trees$Transformer.transform(Trees.scala:656)
	at scala.tools.nsc.transform.CleanUp$CleanUpTransformer.transform(CleanUp.scala:692)
	at scala.tools.nsc.transform.CleanUp$CleanUpTransformer.transform(CleanUp.scala:25)
	at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:227)
	at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:455)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:422)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:422)
	at scala.collection.Iterator$class.foreach(Iterator.scala:726)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1155)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:422)
	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1566)
	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1540)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1536)
	at scala.tools.nsc.Global$Run.compile(Global.scala:1646)
	at xsbt.CompilerInterface.run(CompilerInterface.scala:87)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:57)
	at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:29)
	at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:25)
	at sbt.AggressiveCompile$$anonfun$5.compileScala$1(AggressiveCompile.scala:67)
	at sbt.AggressiveCompile$$anonfun$5.apply(AggressiveCompile.scala:79)
	at sbt.AggressiveCompile$$anonfun$5.apply(AggressiveCompile.scala:57)
	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:21)
	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:19)
	at sbt.inc.Incremental$.cycle(Incremental.scala:33)
	at sbt.inc.Incremental$.compile(Incremental.scala:20)
	at sbt.inc.IncrementalCompile$.apply(Compile.scala:17)
	at sbt.AggressiveCompile.compile2(AggressiveCompile.scala:87)
	at sbt.AggressiveCompile.compile1(AggressiveCompile.scala:41)
	at sbt.AggressiveCompile.apply(AggressiveCompile.scala:28)
	at sbt.Compiler$.apply(Compiler.scala:107)
	at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:479)
	at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:479)
	at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:473)
	at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:473)
	at scala.Function1$$anonfun$compose$1.apply(Function1.scala:41)
	at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$11.apply(Structure.scala:295)
	at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$11.apply(Structure.scala:295)
	at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
	at sbt.std.Transform$$anon$5.work(System.scala:67)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:221)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:221)
	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
	at sbt.Execute.work(Execute.scala:227)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:221)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:221)
	at sbt.CompletionService$$anon$1$$anon$2.call(CompletionService.scala:26)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:680)
[error] {file:/Users/scott/projects/toolkit/}toolkit-algebra/compile:compile: scala.MatchError: (xs: collection.GenIterable)Int <and> (x0: Int, x1: Seq)Int <and> (x: Int, y: Int)Int (of class scala.reflect.internal.Types$OverloadedType)
@scabug
Copy link
Author

@scabug scabug commented Aug 31, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6301?orig=1
Reporter: Scott Morrison (scott)
Affected Versions: 2.10.0-M6
See #6572

@scabug
Copy link
Author

@scabug scabug commented Aug 31, 2012

@axel22 said:
A minimized test case would be helpful.

@scabug
Copy link
Author

@scabug scabug commented Aug 31, 2012

Scott Morrison (scott) said:
I did spend a while investigating, but needed to triage my time spent on this, and report as best I could. I'm sorry it's still a monster.

@scabug
Copy link
Author

@scabug scabug commented Aug 31, 2012

@paulp said:
That's OK, I can see what it is. I can't exactly fix it right now, but I can do this:

Select received overloaded type during explicitouter, but typer is over.
We are likely doomed to crash in the backend.
modP.add$mcI$sp has these overloads:
  def add$mcI$sp(xs: scala.collection.GenIterable[Int]): Int
  def add$mcI$sp(x0: Int,x1: Seq[Int]): Int
  def add$mcI$sp(x: Int,y: Int): Int

[...]
[warn] /Users/paulp/Desktop/toolkit/algebra/src/main/scala/net/tqft/toolkit/algebra/grouptheory/FiniteGroup.scala:223: Overloaded type reached the backend! This is a bug in scalac.
[warn]      Symbol: value add$mcI$sp
[warn]   Overloads: (xs: collection.GenIterable)Int <and> (x0: Int, x1: Seq)Int <and> (x: Int, y: Int)Int
[warn]   Arguments: List(Object)
[warn]     def mu(i: Int)(j: Int)(s: Int) = modP.quotient(modP.add(for (n <- 0 until exponent) yield modP.multiply(chi(i)(exponentiationOnConjugacyClasses(n)(j)), zpower((-s * n) mod exponent))), exponent)
[warn]                                                            ^
[warn] Only one overload has the right arity, proceeding with overload List((xs: collection.GenIterable)Int)
[warn] there were 7 deprecation warnings; re-run with -deprecation for details
[warn] there were 50 feature warnings; re-run with -feature for details
[warn] four warnings found
[success] Total time: 38 s, completed Aug 31, 2012 8:32:58 AM

@scabug
Copy link
Author

@scabug scabug commented Aug 31, 2012

@paulp said:
I lied, I fixed it.

@scabug
Copy link
Author

@scabug scabug commented Sep 1, 2012

@paulp said:
The fix is amongst scala/scala#1226 .

@scabug
Copy link
Author

@scabug scabug commented Jan 29, 2013

@retronym said:
Backport scala/scala#2006

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants