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

Compiler crashes on code with typo #10123

Closed
scabug opened this issue Dec 27, 2016 · 2 comments
Closed

Compiler crashes on code with typo #10123

scabug opened this issue Dec 27, 2016 · 2 comments

Comments

@scabug
Copy link

scabug commented Dec 27, 2016

The following(invalid) code crashed the compiler:

val pp=Array.ofDim[Double](10)
pp(bar(0)) += 4

Expected behavior is an error indicating "bar" is not found anywhere,
actual behavior is the compiler crashing with the exception bellow, tried in Scala console and as part of a project built with SBT.
bug appears in scala 2.11.8 and 2.11.1 bug does not appear in 2.10.2
All tests were with Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_55
on Ubuntu

ReplGlobal.abort: Unknown type: , [class scala.reflect.internal.Types$ErrorType$, class scala.reflect.internal.Types$ErrorType$] TypeRef? false
error:
Unknown type: , [class scala.reflect.internal.Types$ErrorType$, class scala.reflect.internal.Types$ErrorType$] TypeRef? false
while compiling:
during phase: icode
library version: version 2.11.8
compiler version: version 2.11.8
reconstructed args: -usejavacp

last tree to typer: TypeTree(class Array)
tree position: line 12 of
tree tpe: Array[Double]
symbol: final class Array in package scala
symbol definition: final class Array[T] extends Object (a ClassSymbol)
symbol package: scala
symbol owners: class Array
call site: object iw in package $line3 in package $line3

scala.reflect.internal.FatalError: Unknown type: , [class scala.reflect.internal.Types$ErrorType$, class scala.reflect.internal.Types$ErrorType$] TypeRef? false while compiling: during phase: icode library version: version 2.11.8 compiler version: version 2.11.8 reconstructed args: -usejavacp

last tree to typer: TypeTree(class Array)
tree position: line 12 of
tree tpe: Array[Double]
symbol: final class Array in package scala
symbol definition: final class Array[T] extends Object (a ClassSymbol)
symbol package: scala
symbol owners: class Array
call site: object iw in package $line3 in package $line3

at scala.reflect.internal.Reporting$class.abort(Reporting.scala:59) at scala.tools.nsc.interpreter.IMain$$anon$1.scala$tools$nsc$interpreter$ReplGlobal$$super$abort(IMain.scala:247) at scala.tools.nsc.interpreter.ReplGlobal$class.abort(ReplGlobal.scala:20) at scala.tools.nsc.interpreter.IMain$$anon$1.abort(IMain.scala:247) at scala.tools.nsc.backend.icode.TypeKinds$class.toTypeKind(TypeKinds.scala:401) at scala.tools.nsc.backend.icode.ICodes.toTypeKind(ICodes.scala:19) at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genLoadValDef$1(GenICode.scala:516) at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:533) at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genStat(GenICode.scala:181) 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:124) at scala.collection.immutable.List.foldLeft(List.scala:84) at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:922) at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:923) at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:123) at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:71) at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:148) at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:98) at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:71) at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:89) at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:67) at scala.tools.nsc.backend.icode.GenICode$ICodePhase.apply(GenICode.scala:63) at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply$mcV$sp(Global.scala:440) at scala.tools.nsc.Global$GlobalPhase.withCurrentUnit(Global.scala:431) at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:440) at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:398) at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:398) at scala.collection.Iterator$class.foreach(Iterator.scala:893) at scala.collection.AbstractIterator.foreach(Iterator.scala:1336) at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:398) at scala.tools.nsc.backend.icode.GenICode$ICodePhase.run(GenICode.scala:55) at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1501) at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1486) at scala.tools.nsc.Global$Run.compileSources(Global.scala:1481) at scala.tools.nsc.interpreter.IMain.compileSourcesKeepingRun(IMain.scala:435) at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compileAndSaveRun(IMain.scala:855) at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compile(IMain.scala:813) at scala.tools.nsc.interpreter.IMain$Request.compile$lzycompute(IMain.scala:1002) at scala.tools.nsc.interpreter.IMain$Request.compile(IMain.scala:997) at scala.tools.nsc.interpreter.IMain.compile(IMain.scala:579) at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:567) at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:565) at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:807) at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:825) at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:825) at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:825) at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:681) at scala.tools.nsc.interpreter.ILoop.processLine(ILoop.scala:395) at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:415) at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:923) at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:909) at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:909) at scala.reflect.internal.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:97) at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:909) at scala.tools.nsc.interpreter.ILoop.main(ILoop.scala:934) at org.jetbrains.plugins.scala.compiler.rt.ConsoleRunner.main(ConsoleRunner.java:64)
@scabug
Copy link
Author

scabug commented Dec 27, 2016

Imported From: https://issues.scala-lang.org/browse/SI-10123?orig=1
Reporter: Meir Maor (meirmaor)
Affected Versions: 2.11.8
Duplicates #8763, #9834

@scabug
Copy link
Author

scabug commented Dec 27, 2016

@som-snytt said:

$ ./build/pack/bin/scala
Welcome to Scala 2.11.9-20161219-090438-23548c4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_111).
Type in expressions for evaluation. Or try :help.

scala> val pp=Array.ofDim[Double](10)
pp: Array[Double] = Array(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)

scala> pp(bar(0)) += 4
<console>:13: error: not found: value bar
       pp(bar(0)) += 4
          ^

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