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

"Unexpected tree in genLoad" compiler crash when invoking super.+(String) #5063

Closed
scabug opened this issue Oct 6, 2011 · 5 comments
Closed

Comments

@scabug
Copy link

scabug commented Oct 6, 2011

Try to compile this:

class A {
  super.+("")
}

and you'll get this:

Exception in thread "main" java.lang.Error: Unexpected tree in genLoad: A.super at: source-../scala/test/files/neg/supper-to-breakfast.scala,line-2,offset=12
	at scala.tools.nsc.symtab.SymbolTable.abort(SymbolTable.scala:33)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:941)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genLoadArguments(GenICode.scala:1030)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:742)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genLoadQualifier(GenICode.scala:981)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:739)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genStat(GenICode.scala:183)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genStat$1.apply(GenICode.scala:155)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genStat$1.apply(GenICode.scala:155)
	at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:123)
	at scala.collection.immutable.List.foldLeft(List.scala:45)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genStat(GenICode.scala:155)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:868)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:126)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:81)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:81)
	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
	at scala.collection.immutable.List.foreach(List.scala:45)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:81)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:148)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:100)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:81)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:81)
	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
	at scala.collection.immutable.List.foreach(List.scala:45)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:81)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:91)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:77)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.apply(GenICode.scala:73)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply(Global.scala:288)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply(Global.scala:288)
	at scala.tools.nsc.reporters.Reporter.withSource(Reporter.scala:47)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:288)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:260)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:260)
	at scala.collection.Iterator$class.foreach(Iterator.scala:631)
	at scala.collection.mutable.ListBuffer$$anon$1.foreach(ListBuffer.scala:304)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:260)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.run(GenICode.scala:66)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:761)
	at scala.tools.nsc.Global$Run.compile(Global.scala:842)
	at scala.tools.nsc.Main$.process(Main.scala:106)
	at scala.tools.nsc.Main$.main(Main.scala:120)
	at scala.tools.nsc.Main.main(Main.scala)

The problem is specific to the +(String) method, and involves implicit view any2stringadd applied on A.super, as if super was not as the reserved word it is.

@scabug
Copy link
Author

scabug commented Oct 6, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5063?orig=1
Reporter: @jsalvata
Affected Versions: 2.9.2

@scabug
Copy link
Author

scabug commented Oct 31, 2011

@paulp said:
Subsuming into #4987.

@scabug
Copy link
Author

scabug commented Mar 21, 2012

@paulp said:
Reopening because the subsumption ticket seems to have been fixed as a consequence of error trees, but this wasn't.

@scabug
Copy link
Author

scabug commented May 2, 2012

@axel22 said (edited on May 2, 2012 5:59:54 PM UTC):
Seems to work now. That is, fails with an error message.

@scabug scabug closed this as completed May 2, 2012
@scabug
Copy link
Author

scabug commented May 2, 2012

@paulp said:
Looks like martin fixed in bed3304bf86 .

@scabug scabug added this to the 2.10.0-M2 milestone Apr 7, 2017
Blaisorblade added a commit to dotty-staging/dotty that referenced this issue Aug 26, 2018
Based on scala/scala@bed3304bf86 and Nicolas' suggestion.
Blaisorblade added a commit to dotty-staging/dotty that referenced this issue Aug 26, 2018
Based on scala/scala@bed3304bf86 and Nicolas' suggestion.
allanrenucci added a commit to scala/scala3 that referenced this issue Sep 3, 2018
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