specialized - an unexpected type representation reached

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

specialized - an unexpected type representation reached

eugeniy.d
Hello

class Ccc[@specialized(Double) A]() {
    var s: A = _
}

class Foo[@specialized(Double) A]() {
    val (a, b) = (1, 2 + 3)
    val ccc = new Ccc[A]()
}

Welcome to Scala 2.12.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_92).
Type in expressions for evaluation. Or try :help.

scala> class Ccc[@specialized(Double) A]() {
     |     var s: A = _
     | }
defined class Ccc

scala> class Foo[@specialized(Double) A]() {
     |     val (a, b) = (1, 2 + 3)
     |     val ccc = new Ccc[A]()
     | }
warning: an unexpected type representation reached the compiler backend while compiling <console>: => Tuple2. If possible, please file a bug on issues.scala-lang.org.
scala.MatchError: => Tuple2 (of class scala.reflect.internal.Types$NullaryMethodType)
    at scala.tools.nsc.backend.jvm.BTypesFromSymbols.typeToBType(BTypesFromSymbols.scala:212)
    at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.symInfoTK(BCodeSkelBuilder.scala:77)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:331)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genComparisonOp$1(BCodeBodyBuilder.scala:1206)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genCond(BCodeBodyBuilder.scala:1252)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoadIf(BCodeBodyBuilder.scala:192)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:281)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLabelDef(BCodeBodyBuilder.scala:474)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:261)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genStat(BCodeBodyBuilder.scala:82)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.$anonfun$genBlock$1(BCodeBodyBuilder.scala:817)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genBlock(BCodeBodyBuilder.scala:817)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:364)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genStat(BCodeBodyBuilder.scala:68)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.$anonfun$genBlock$1(BCodeBodyBuilder.scala:817)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genBlock(BCodeBodyBuilder.scala:817)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:364)
    at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.emitNormalMethodBody$1(BCodeSkelBuilder.scala:604)
    at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genDefDef(BCodeSkelBuilder.scala:636)
    at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen(BCodeSkelBuilder.scala:510)
    at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.$anonfun$gen$7(BCodeSkelBuilder.scala:512)
    at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen(BCodeSkelBuilder.scala:512)
    at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genPlainClass(BCodeSkelBuilder.scala:113)
    at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase$Worker1.visit(GenBCode.scala:190)
    at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase$Worker1.$anonfun$run$1(GenBCode.scala:139)
    at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase$Worker1.run(GenBCode.scala:139)
    at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.buildAndSendToDisk(GenBCode.scala:381)
    at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.run(GenBCode.scala:350)
    at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1404)
    at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1389)
    at scala.tools.nsc.Global$Run.compileSources(Global.scala:1384)
    at scala.tools.nsc.interpreter.IMain.compileSourcesKeepingRun(IMain.scala:430)
    at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compileAndSaveRun(IMain.scala:801)
    at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compile(IMain.scala:759)
    at scala.tools.nsc.interpreter.IMain$Request.compile$lzycompute(IMain.scala:948)
    at scala.tools.nsc.interpreter.IMain$Request.compile(IMain.scala:943)
    at scala.tools.nsc.interpreter.IMain.compile(IMain.scala:599)
    at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:588)
    at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:560)
    at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:825)
    at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:843)
    at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:843)
    at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:843)
    at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:684)
    at scala.tools.nsc.interpreter.ILoop.processLine(ILoop.scala:402)
    at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:423)
    at scala.tools.nsc.interpreter.ILoop.$anonfun$process$1(ILoop.scala:993)
    at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:892)
    at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:79)
    at scala.tools.nsc.MainGenericRunner.run$1(MainGenericRunner.scala:92)
    at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:103)
    at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:108)
    at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
error: Error while emitting <console>
=> Tuple2 (of class scala.reflect.internal.Types$NullaryMethodType)

on 2.11.8 - internal error too
if remove at least one of @specialized(Double) - ok
if replace "val (a, b) = (1, 2 + 3)" with two val`s - ok with both specialized


--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: specialized - an unexpected type representation reached

Lukas Rytz-2
Hi,
Thanks for the report, I filed a ticket: https://issues.scala-lang.org/browse/SI-10096
Cheers: Lukas

On Sun, Dec 4, 2016 at 9:23 AM, <[hidden email]> wrote:
Hello

class Ccc[@specialized(Double) A]() {
    var s: A = _
}

class Foo[@specialized(Double) A]() {
    val (a, b) = (1, 2 + 3)
    val ccc = new Ccc[A]()
}

Welcome to Scala 2.12.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_92).
Type in expressions for evaluation. Or try :help.

scala> class Ccc[@specialized(Double) A]() {
     |     var s: A = _
     | }
defined class Ccc

scala> class Foo[@specialized(Double) A]() {
     |     val (a, b) = (1, 2 + 3)
     |     val ccc = new Ccc[A]()
     | }
warning: an unexpected type representation reached the compiler backend while compiling <console>: => Tuple2. If possible, please file a bug on issues.scala-lang.org.
scala.MatchError: => Tuple2 (of class scala.reflect.internal.Types$NullaryMethodType)
    at scala.tools.nsc.backend.jvm.BTypesFromSymbols.typeToBType(BTypesFromSymbols.scala:212)
    at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.symInfoTK(BCodeSkelBuilder.scala:77)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:331)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genComparisonOp$1(BCodeBodyBuilder.scala:1206)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genCond(BCodeBodyBuilder.scala:1252)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoadIf(BCodeBodyBuilder.scala:192)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:281)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLabelDef(BCodeBodyBuilder.scala:474)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:261)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genStat(BCodeBodyBuilder.scala:82)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.$anonfun$genBlock$1(BCodeBodyBuilder.scala:817)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genBlock(BCodeBodyBuilder.scala:817)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:364)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genStat(BCodeBodyBuilder.scala:68)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.$anonfun$genBlock$1(BCodeBodyBuilder.scala:817)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genBlock(BCodeBodyBuilder.scala:817)
    at scala.tools.nsc.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:364)
    at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.emitNormalMethodBody$1(BCodeSkelBuilder.scala:604)
    at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genDefDef(BCodeSkelBuilder.scala:636)
    at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen(BCodeSkelBuilder.scala:510)
    at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.$anonfun$gen$7(BCodeSkelBuilder.scala:512)
    at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen(BCodeSkelBuilder.scala:512)
    at scala.tools.nsc.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genPlainClass(BCodeSkelBuilder.scala:113)
    at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase$Worker1.visit(GenBCode.scala:190)
    at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase$Worker1.$anonfun$run$1(GenBCode.scala:139)
    at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase$Worker1.run(GenBCode.scala:139)
    at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.buildAndSendToDisk(GenBCode.scala:381)
    at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.run(GenBCode.scala:350)
    at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1404)
    at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1389)
    at scala.tools.nsc.Global$Run.compileSources(Global.scala:1384)
    at scala.tools.nsc.interpreter.IMain.compileSourcesKeepingRun(IMain.scala:430)
    at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compileAndSaveRun(IMain.scala:801)
    at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compile(IMain.scala:759)
    at scala.tools.nsc.interpreter.IMain$Request.compile$lzycompute(IMain.scala:948)
    at scala.tools.nsc.interpreter.IMain$Request.compile(IMain.scala:943)
    at scala.tools.nsc.interpreter.IMain.compile(IMain.scala:599)
    at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:588)
    at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:560)
    at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:825)
    at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:843)
    at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:843)
    at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:843)
    at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:684)
    at scala.tools.nsc.interpreter.ILoop.processLine(ILoop.scala:402)
    at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:423)
    at scala.tools.nsc.interpreter.ILoop.$anonfun$process$1(ILoop.scala:993)
    at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:892)
    at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:79)
    at scala.tools.nsc.MainGenericRunner.run$1(MainGenericRunner.scala:92)
    at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:103)
    at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:108)
    at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
error: Error while emitting <console>
=> Tuple2 (of class scala.reflect.internal.Types$NullaryMethodType)

on 2.11.8 - internal error too
if remove at least one of @specialized(Double) - ok
if replace "val (a, b) = (1, 2 + 3)" with two val`s - ok with both specialized


--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.