-
Notifications
You must be signed in to change notification settings - Fork 21
Compiler crash when invoking a private constructor with invalid arguments #4987
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
Comments
Imported From: https://issues.scala-lang.org/browse/SI-4987?orig=1
|
@melezov said: |
@melezov said (edited on Sep 12, 2011 1:51:09 PM UTC): /* This will not crash, but rather complain, which is OK */ /* This will slay the compiler */ |
@odersky said (edited on Mar 21, 2012 2:58:15 PM UTC): /Users/odersky/Downloads/FooBar.scala:9: error: constructor Foo in class Foo cannot be accessed in object Bar |
@soc said: error: Unexpected New(TypeTree class $read$Foo2/Foo2) received in icode.
Call was genLoad(new Foo2, package: $line2
clazz: Bar2
method: Bar2.<init>
bb: 1
labels: Map()
exception handlers: List()
cleanups: List()
scope: [][][]
,REF(class Object))
error:
while compiling: <console>
current phase: icode
library version: version 2.10.0-M2-0152-g5dca64cefe-2012-03-13
compiler version: version 2.10.0-M2-0152-g5dca64cefe-2012-03-13
reconstructed args:
uncaught exception during compilation: scala.reflect.internal.FatalError
scala.reflect.internal.FatalError:
while compiling: <console>
current phase: icode
library version: version 2.10.0-M2-0152-g5dca64cefe-2012-03-13
compiler version: version 2.10.0-M2-0152-g5dca64cefe-2012-03-13
reconstructed args:
Unexpected New(TypeTree class $read$$iw$$iw$Foo2/$line1.$read$$iw$$iw$Foo2) received in icode.
Call was genLoad(new $line1.$read$$iw$$iw$Foo2, package: $line2
clazz: $line2.$read$$iw$$iw$Bar2
method: $line2.$read$$iw$$iw$Bar2.<init>
bb: 1
labels: Map()
exception handlers: List()
cleanups: List()
scope: [][][]
,REF(class Object))
at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:38)
at scala.tools.nsc.Global.abort(Global.scala:189)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:707)
at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$genLoadArguments$1.apply(GenICode.scala:1200)
|
@paulp said: // 2.10.0-20120320-201545-fcc63e2b66
scalac ./a.scala
./a.scala:10: error: constructor Foo2 in class Foo2 cannot be accessed in object Bar2
object Bar2 { new Foo2(0, 0) }
^
one error found |
@paulp said: |
If one invokes a private / protected constructor with an invalid number of arguments (or a mismatched signature), the compiler will crash with an "Unexpected New" exception.
The text was updated successfully, but these errors were encountered: