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

Crash in adaptNullRef #7231

Closed
scabug opened this issue Mar 8, 2013 · 5 comments
Closed

Crash in adaptNullRef #7231

scabug opened this issue Mar 8, 2013 · 5 comments

Comments

@scabug
Copy link

scabug commented Mar 8, 2013

The compiler crashes with an assertion error while building the IDE. The exception trace is below, I attached the full info. I'll report back if I can minimize it.

EDIT: Minimized code:

trait T {
  def bar: Array[String]
}

class Foo extends T {
  def bar = null
}
[INFO] == Expanded type of tree ==
[INFO] 
[INFO] TypeRef(TypeSymbol(final abstract class Unit extends ))
[INFO] 
[INFO] Attempt to adapt a null to a non reference type $to.
[INFO] 	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.adaptNullRef(GenICode.scala:1028)
[INFO] 	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genLoadApply6$1(GenICode.scala:800)
[INFO] 	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:804)
[INFO] 	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:122)
[INFO] 	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:70)
[INFO] 	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:147)
[INFO] 	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:97)
[INFO] 	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:70)
[INFO] 	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:88)
[INFO] 	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:66)
[INFO] 	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.apply(GenICode.scala:62)
[INFO] 	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:413)
[INFO] 	at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:380)
[INFO] 	at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:380)
[INFO] 	at scala.collection.Iterator$class.foreach(Iterator.scala:725)
[INFO] 	at scala.collection.AbstractIterator.foreach(Iterator.scala:1156)
[INFO] 	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:380)
[INFO] 	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.run(GenICode.scala:55)
[INFO] 	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1508)
[INFO] 	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1483)
[INFO] 	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1479)
[INFO] 	at scala.tools.nsc.Global$Run.compile(Global.scala:1586)
[INFO] 	at scala.tools.nsc.Driver.doCompile(Driver.scala:33)
[INFO] 	at scala.tools.nsc.MainClass.doCompile(Main.scala:21)
[INFO] 	at scala.tools.nsc.Driver.process(Driver.scala:54)
[INFO] 	at scala.tools.nsc.Driver.main(Driver.scala:67)
[INFO] 	at scala.tools.nsc.Main.main(Main.scala)
[INFO] 	... 6 more
@scabug
Copy link
Author

scabug commented Mar 8, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7231?orig=1
Reporter: @dragos
Assignee: @JamesIry
Affected Versions: 2.11.0-M2
Attachments:

@scabug
Copy link
Author

scabug commented Mar 8, 2013

@paulp said:
Ah yes, good old type $to.

@scabug
Copy link
Author

scabug commented Mar 8, 2013

@JamesIry said:
Iulian, thanks for the minimization. It confirms what I suspected. Also, it would be great if we had a warning for string literals with $foo where foo is an identifier in scope, but Paul P. tells me the warning is too noisy. Maybe -Xlint.

@scabug
Copy link
Author

scabug commented Mar 8, 2013

@JamesIry said:
scala/scala#2216

@scabug
Copy link
Author

scabug commented Mar 8, 2013

@dragos said:
I just realized why I wasted hours on this... the error message is very confusing. The trees that it spits out have nothing to do with what was compiled during the crash (probably the last tree that passed by the typer, 12 phases before?). Since they are so verbose, they completely dwarfed the only piece of useful information: the file name that was compiled at the time of the crash. Could the machinery that prints trees be made backend friendly? That would definitely save some time next time.

@scabug scabug closed this as completed Mar 8, 2013
@scabug scabug added this to the 2.11.0-M2 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
Development

No branches or pull requests

1 participant