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

2.9.0 regression: compiler crash when accessing collection.immutable.Set.Set2 constructor #4645

Closed
scabug opened this issue May 25, 2011 · 3 comments
Assignees

Comments

@scabug
Copy link

scabug commented May 25, 2011

The following line crashes the compiler:

new collection.immutable.Set.Set2(1, 2)

Note that Set2's constructor is package private and it shouldn't actually reach icode.

error: java.lang.Error: Unexpected New
	at scala.tools.nsc.symtab.SymbolTable.abort(SymbolTable.scala:35)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:725)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genLoadArguments$1.apply(GenICode.scala:1226)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genLoadArguments$1.apply(GenICode.scala:1224)
	at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:111)
	at scala.collection.immutable.List.foldLeft(List.scala:45)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genLoadArguments(GenICode.scala:1224)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:924)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genLoadQualifier(GenICode.scala:1175)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:921)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genStat(GenICode.scala:174)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genStat$1.apply(GenICode.scala:143)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genStat$1.apply(GenICode.scala:143)
	at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:111)
	at scala.collection.immutable.List.foldLeft(List.scala:45)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genStat(GenICode.scala:143)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:1052)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:114)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:69)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:69)
	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
	at scala.collection.immutable.List.foreach(List.scala:45)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:69)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:136)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:88)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:69)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:69)
	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
	at scala.collection.immutable.List.foreach(List.scala:45)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:69)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:79)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:65)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.apply(GenICode.scala:61)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply(Global.scala:326)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply(Global.scala:326)
	at scala.tools.nsc.reporters.Reporter.withSource(Reporter.scala:47)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:326)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:294)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:294)
	at scala.collection.Iterator$class.foreach(Iterator.scala:652)
	at scala.collection.mutable.ListBuffer$$anon$1.foreach(ListBuffer.scala:311)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:294)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.run(GenICode.scala:54)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:949)
	at scala.tools.nsc.Global$Run.compile(Global.scala:1034)
	at scala.tools.nsc.Main$.process(Main.scala:106)
	at scala.tools.nsc.Main$.main(Main.scala:123)
	at scala.tools.nsc.Main.main(Main.scala)

@scabug
Copy link
Author

scabug commented May 25, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4645?orig=1
Reporter: @ingoem
Affected Versions: 2.9.0

@scabug
Copy link
Author

scabug commented Jul 13, 2011

@paulp said:
There is something truly unholy taking place here with implicit conversions and auto-tupling.

If you give an extra pair of parens it fails in typer as it should:

scala> new collection.immutable.Set.Set2((1, 2))
<console>:8: error: constructor Set2 in class Set2 cannot be accessed in object $iw
              new collection.immutable.Set.Set2((1, 2))
              ^

Take them away, and behold! A little something for everyone in that expression. It's not even calling '+' on the StringAdd instance.

scala> new collection.immutable.Set.Set2(1, 2)
[...]
private[this] val res0: scala.runtime.StringAdd = 
  scala.this.Predef.any2stringadd(new collection.immutable.Set.Set2[Nothing]).this(scala.this.Tuple2.apply[Int, Int](1, 2));

@scabug
Copy link
Author

scabug commented Oct 30, 2011

@paulp said:
#4645, #4685, #4707, #4987, #5058 are all the same bug. Consolidating under #4987.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants