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

Crasher #39

Open
VladUreche opened this issue Jun 23, 2014 · 0 comments
Open

Crasher #39

VladUreche opened this issue Jun 23, 2014 · 0 comments

Comments

@VladUreche
Copy link
Member

$ cat test-val.scala 

package test.value

@value class Complex(val re: Double, val im: Double) {
  def +(other: Complex): Complex =
    new Complex(re + other.re, im + other.im)
  override def toString = s"$re + $im * i"
}

object Test {
  val c1 = new Complex(0.0, 1.0)
  val c2 = new Complex(1.0, 0.0)

  c1 + c2
}

$ va-scalac test-val.scala 
error: symbol value 21$re does not exist in test.value.Test.<init>
error: scala.reflect.internal.FatalError:
  symbol value 21$re does not exist in test.value.Test.<init>
     while compiling: test-val.scala
        during phase: icode
     library version: version 2.11.1-20140519-130118-1e1defd99c
    compiler version: version 2.11.1-20140519-130118-1e1defd99c
  reconstructed args: -bootclasspath /home/sun/workspace/dev-2.11/valium//components/runtime/target/scala-2.11/valium-runtime_2.11-0.1-SNAPSHOT.jar:/home/sun/workspace/dev-2.11/valium//components/plugin/target/scala-2.11/valium-plugin_2.11-0.1-SNAPSHOT.jar -Xplugin:/home/sun/workspace/dev-2.11/valium//components/plugin/target/scala-2.11/valium-plugin_2.11-0.1-SNAPSHOT.jar

  last tree to typer: Ident(other$$21$im)
       tree position: line 14 of test-val.scala
            tree tpe: Double
              symbol: value 21$im in object Test
   symbol definition: val 21$im: Double (a TermSymbol)
      symbol package: test.value
       symbol owners: value 21$im -> object Test
           call site: constructor Test in object Test in package value

== Source file context for tree position ==

    11     val c2 = new Complex(1.0, 0.0)
    12
    13     c1 + c2
    14   // }
    15 }
    at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:58)
    at scala.tools.nsc.Global.abort(Global.scala:269)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genLoadIdent$1(GenICode.scala:885)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:891)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genStat(GenICode.scala:170)
    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:110)
    at scala.collection.immutable.List.foldLeft(List.scala:83)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genStat(GenICode.scala:155)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:915)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:123)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:71)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:71)
    at scala.collection.immutable.List.foreach(List.scala:383)
    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$$anonfun$gen$1.apply(GenICode.scala:71)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$gen$1.apply(GenICode.scala:71)
    at scala.collection.immutable.List.foreach(List.scala:383)
    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.applyPhase(Global.scala:430)
    at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:397)
    at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:397)
    at scala.collection.Iterator$class.foreach(Iterator.scala:743)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1174)
    at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:397)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase.run(GenICode.scala:55)
    at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1625)
    at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1610)
    at scala.tools.nsc.Global$Run.compileSources(Global.scala:1605)
    at scala.tools.nsc.Global$Run.compile(Global.scala:1703)
    at scala.tools.nsc.Driver.doCompile(Driver.scala:34)
    at scala.tools.nsc.MainClass.doCompile(Main.scala:23)
    at scala.tools.nsc.Driver.process(Driver.scala:55)
    at scala.tools.nsc.Driver.main(Driver.scala:68)
    at scala.tools.nsc.Main.main(Main.scala) 

Maybe useful:

$ va-scalac test-val.scala -Xprint:valium-commit -Ystop-after:valium-commit
[[syntax trees at end of             valium-commit]] // test-val.scala
package test.value {
  @value final class Complex extends Object {
    <paramaccessor> private[this] val re: Double = _;
    <stable> <accessor> <paramaccessor> def re(): Double = Complex.this.re;
    <paramaccessor> private[this] val im: Double = _;
    <stable> <accessor> <paramaccessor> def im(): Double = Complex.this.im;
    def <init>(re: Double, im: Double): test.value.Complex = {
      Complex.super.<init>();
      ()
    };
    def +(other$re: Double, other$im: Double): test.value.Complex = {
      <synthetic> val $$6: test.value.Complex = Complex.this;
      <synthetic> val 1$re: Double = $$6.re;
      <synthetic> val 1$im: Double = $$6.im;
      <synthetic> val this$re$2: Double = 1$re;
      <synthetic> val this$im$3: Double = 1$im;
      <synthetic> val arg$other$re$4: Double = other$re;
      <synthetic> val arg$other$im$5: Double = other$im;
      value.this.Complex.+$xtension(this$re$2, this$im$3, arg$other$re$4, arg$other$im$5)
    };
    override def toString(): String = {
      <synthetic> val $$10: test.value.Complex = Complex.this;
      <synthetic> val 7$re: Double = $$10.re;
      <synthetic> val 7$im: Double = $$10.im;
      <synthetic> val this$re$8: Double = 7$re;
      <synthetic> val this$im$9: Double = 7$im;
      value.this.Complex.toString$xtension(this$re$8, this$im$9)
    };
    override <synthetic> def equals(x$1: Any): Boolean = {
      <synthetic> val $$15: test.value.Complex = Complex.this;
      <synthetic> val 11$re: Double = $$15.re;
      <synthetic> val 11$im: Double = $$15.im;
      <synthetic> val this$re$12: Double = 11$re;
      <synthetic> val this$im$13: Double = 11$im;
      <synthetic> val 14: Any = x$1;
      value.this.Complex.equals$xtension(this$re$12, this$im$13, 14)
    };
    override <synthetic> def hashCode(): Int = {
      <synthetic> val $$19: test.value.Complex = Complex.this;
      <synthetic> val 16$re: Double = $$19.re;
      <synthetic> val 16$im: Double = $$19.im;
      <synthetic> val this$re$17: Double = 16$re;
      <synthetic> val this$im$18: Double = 16$im;
      value.this.Complex.hashCode$xtension(this$re$17, this$im$18)
    }
  };
  <synthetic> object Complex extends Object {
    def <init>(): test.value.Complex.type = {
      Complex.super.<init>();
      ()
    };
    final def +$xtension($this$re: Double, $this$im: Double, other$re: Double, other$im: Double): test.value.Complex = new test.value.Complex($this$re.+(other$re), $this$im.+(other$im));
    final def toString$xtension($this$re: Double, $this$im: Double): String = new StringContext(scala.this.Predef.wrapRefArray[String](Array[String]{"", " + ", " * i"})).s(scala.this.Predef.genericWrapArray[Any](Array[Any]{$this$re, $this$im}));
    final <synthetic> def equals$xtension($this$re: Double, $this$im: Double, x$1: Any): Boolean = x$1.isInstanceOf[test.value.Complex]().&&({
      <synthetic> val $$20: test.value.Complex = x$1.asInstanceOf[test.value.Complex]();
      <synthetic> val Complex$1$re: Double = $$20.re;
      <synthetic> val Complex$1$im: Double = $$20.im;
      $this$re.==(Complex$1$re).&&($this$im.==(Complex$1$im))
    });
    final <synthetic> def hashCode$xtension($this$re: Double, $this$im: Double): Int = -1679819632.+($this$re.hashCode()).+($this$im.hashCode())
  };
  object Test extends Object {
    def <init>(): test.value.Test.type = {
      Test.super.<init>();
      ()
    };
    <synthetic> private[this] val c1$re: Double = 0.0;
    <synthetic> private[this] val c1$im: Double = 1.0;
    <stable> <accessor> def c1(): test.value.Complex = new test.value.Complex(Test.this.c1$re, Test.this.c1$im);
    <synthetic> private[this] val c2$re: Double = 1.0;
    <synthetic> private[this] val c2$im: Double = 0.0;
    <stable> <accessor> def c2(): test.value.Complex = new test.value.Complex(Test.this.c2$re, Test.this.c2$im);
    <synthetic> val $$24: test.value.Complex = Test.this.c2();
    <synthetic> val 21$re: Double = Test.this.$$24.re;
    <synthetic> val 21$im: Double = Test.this.$$24.im;
    <synthetic> val arg$other$re$22: Double = 21$re;
    <synthetic> val arg$other$im$23: Double = 21$im;
    Test.this.c1().+(arg$other$re$22, arg$other$im$23)
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant