miniboxing / value-plugin

Value class plugin using LDL.
Other
5 stars 1 forks source link

Crash in REPL #40

Open lrytz opened 10 years ago

lrytz commented 10 years ago
lucmac:value-plugin luc$ scala -Xplugin:/Users/luc/scala/value-plugin/components/plugin/target/scala-2.11/valium-plugin_2.11-0.1-SNAPr -cp /Users/luc/scala/value-plugin/components/runtime/target/scala-2.11/valium-runtime_2.11-0.1-SNAPSHOT.jar -Xprint:valium-commit

Welcome to Scala version 2.11.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_65).
Type in expressions to have them evaluated.
Type :help for more information.

scala> @value class C(val a: Int, val b: String)
defined class C

scala> def bar: C = new C(1,"2")
[[syntax trees at end of             valium-commit]] // <console>
package $line4 {
  object $read extends Object {
    def <init>(): $line4.$read.type = {
      $read.super.<init>();
      ()
    };
    object $iw extends Object {
      def <init>(): type = {
        $iw.super.<init>();
        ()
      };
      object $iw extends Object {
        def <init>(): type = {
          $iw.super.<init>();
          ()
        };
        def bar(): C = new C(1, "2")
      }
    }
  }
}

[[syntax trees at end of             valium-commit]] // <console>
package $line4 {
  object $eval extends Object {
    def <init>(): $line4.$eval.type = {
      $eval.super.<init>();
      ()
    };
    <synthetic> lazy private[this] var $result$a: Int = _;
    <synthetic> lazy private[this] var $result$b: String = _;
    <stable> <accessor> lazy def $result(): C = {
      <synthetic> val $$12: C = $line4.$read.$iw.$iw.bar();
      <synthetic> val $$11$a: Int = $$12.a;
      <synthetic> val $$11$b: String = $$12.b;
      $eval.this.$result$a = $$11$a;
      $eval.this.$result$b = $$11$b;
      new C($eval.this.$result$a, $eval.this.$result$b)
    };
    lazy private[this] var $print: String = _;
    <stable> <accessor> lazy def $print(): String = {
      $eval.this.$print = {
        $line4.$read.$iw.$iw;
        "bar: C\n"
      };
      $eval.this.$print
    }
  }
}

java.lang.AssertionError: assertion failed: 
  $eval.this.<init>
     while compiling: <console>
        during phase: globalPhase=mixin, enteringPhase=cleanup
     library version: version 2.11.1
    compiler version: version 2.11.1
  reconstructed args: -Xplugin:/Users/luc/scala/value-plugin/components/plugin/target/scala-2.11/valium-plugin_2.11-0.1-SNAPSHOT.jar -Xprint:valium-commit -classpath /Users/luc/scala/value-plugin/components/runtime/target/scala-2.11/valium-runtime_2.11-0.1-SNAPSHOT.jar -nowarn

  last tree to typer: TypeTree(class Byte)
       tree position: line 5 of <console>
            tree tpe: Byte
              symbol: (final abstract) class Byte in package scala
   symbol definition: final abstract class Byte extends  (a ClassSymbol)
      symbol package: scala
       symbol owners: class Byte
           call site: method $result$lzycompute in object $eval in package $line4

<Cannot read source file>
    at scala.tools.nsc.ast.TreeGen.mkCast(TreeGen.scala:147)
    at scala.tools.nsc.transform.TypeAdaptingTransformer$TypeAdapter$class.cast(TypeAdaptingTransformer.scala:155)
    at scala.tools.nsc.transform.Erasure$Eraser.cast(Erasure.scala:546)
    at scala.tools.nsc.transform.TypeAdaptingTransformer$TypeAdapter$class.adaptToType(TypeAdaptingTransformer.scala:184)
    at scala.tools.nsc.transform.Erasure$Eraser.adaptToType(Erasure.scala:546)
    at scala.tools.nsc.transform.Erasure$Eraser.adapt(Erasure.scala:647)
    at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5319)
    at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5332)
    at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5279)
    at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5283)
    at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:2364)
VladUreche commented 10 years ago

Thanks for the report Lukas! I think you're the first to run the value class plugin in the repl :)