Aladdin - Scala Bugtracking
[#759] project: compiler priority: low category: bug
submitter assigned to status date submitted
Nikolay Martin fixed 2006-09-24 16:48:32.0
subject [contrib #212] Compiler crash with CBN arrays
code
def f[A](x : => A) = x
f(Array(42))(0)

what happened
exception when typing line0$object.f({
  [scala.serializable]final  class $anonfun extends java.lang.Object with scala.Function0$class with \
scala.ScalaObject$class {
    def this(): template $anonfun = {
      $anonfun.super.this();
      $anonfun.this./*Function0$class*/$init$();
      ()
    };
    final def apply(): scala.Array[scala.Int] = scala.Array.apply(Array[scala.Int]{42});
    final  def apply(): java.lang.Object = $anonfun.this.apply()
  };
  (new template $anonfun.this()) : scala.Function0
}).apply
exception when typing line0$object.f({
  [scala.serializable]final  class $anonfun extends java.lang.Object with scala.Function0$class with \
scala.ScalaObject$class {
    def this(): template $anonfun = {
      $anonfun.super.this();
      $anonfun.this./*Function0$class*/$init$();
      ()
    };
    final def apply(): scala.Array[scala.Int] = scala.Array.apply(Array[scala.Int]{42});
    final  def apply(): java.lang.Object = $anonfun.this.apply()
  };
  (new template $anonfun.this()) : scala.Function0
}).apply(0)
exception when typing private  val line1: scala.Int = line0$object.f({
  [scala.serializable]final  class $anonfun extends java.lang.Object with scala.Function0$class with \
scala.ScalaObject$class {
    def this(): template $anonfun = {
      $anonfun.super.this();
      $anonfun.this./*Function0$class*/$init$();
      ()
    };
    final def apply(): scala.Array[scala.Int] = scala.Array.apply(Array[scala.Int]{42});
    final  def apply(): java.lang.Object = $anonfun.this.apply()
  };
  (new template $anonfun.this()) : scala.Function0
}).apply(0)
exception when typing final class line1$object extends java.lang.Object with scala.ScalaObject$class {
  def this(): object line1$object = {
    line1$object.super.this();
    ()
  };
  private  val line1: scala.Int = line0$object.f({
    [scala.serializable]final  class $anonfun extends java.lang.Object with scala.Function0$class wit\
h scala.ScalaObject$class {
      def this(): template $anonfun = {
        $anonfun.super.this();
        $anonfun.this./*Function0$class*/$init$();
        ()
      };
      final def apply(): scala.Array[scala.Int] = scala.Array.apply(Array[scala.Int]{42});
      final  def apply(): java.lang.Object = $anonfun.this.apply()
    };
    (new template $anonfun.this()) : scala.Function0
  }).apply(0);
    def line1(): scala.Int = line1$object.this.line1
}
exception when typing package  {
  final class line1$object extends java.lang.Object with scala.ScalaObject$class {
    def this(): object line1$object = {
      line1$object.super.this();
      ()
    };
    private  val line1: scala.Int = line0$object.f({
      [scala.serializable]final  class $anonfun extends java.lang.Object with scala.Function0$class w\
ith scala.ScalaObject$class {
        def this(): template $anonfun = {
          $anonfun.super.this();
          $anonfun.this./*Function0$class*/$init$();
          ()
        };
        final def apply(): scala.Array[scala.Int] = scala.Array.apply(Array[scala.Int]{42});
        final  def apply(): java.lang.Object = $anonfun.this.apply()
      };
      (new template $anonfun.this()) : scala.Function0
    }).apply(0);
      def line1(): scala.Int = line1$object.this.line1
  }
}
Exception in thread "main" scala.tools.nsc.symtab.Types$TypeError: value apply is not a member of java.lang.Obje\
ct
	at scala.tools.nsc.typechecker.Contexts$Context.error(Contexts.scala:205)
	at scala.tools.nsc.typechecker.Infer$Inferencer.error(Infer.scala:227)
	at scala.tools.nsc.typechecker.Typers$Typer.typedSelect$0(Typers.scala:1321)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1738)
	at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:367)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1807)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1668)
	at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:367)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1807)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1840)
	at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:1874)
	at scala.tools.nsc.typechecker.Typers$Typer.typedValDef(Typers.scala:726)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1478)
	at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:367)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1807)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1834)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$0(Typers.scala:1016)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$47.apply(Typers.scala:1037)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$47.apply(Typers.scala:1037)
	at scala.List$.loop$0(List.scala:239)
	at scala.List$.mapConserve(List.scala:256)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:1037)
	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:708)
	at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:643)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1472)
	at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:367)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1807)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1834)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$0(Typers.scala:1016)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$47.apply(Typers.scala:1037)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$47.apply(Typers.scala:1037)
	at scala.List$.loop$0(List.scala:239)
	at scala.List$.mapConserve(List.scala:256)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:1037)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1468)
	at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:367)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1807)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1834)
	at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anonfun$22.apply(Erasure.scala:655)
	at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anonfun$22.apply(Erasure.scala:652)
	at scala.tools.nsc.symtab.SymbolTable.atPhase(SymbolTable.scala:71)
	at scala.tools.nsc.transform.Erasure$ErasureTransformer.transform(Erasure.scala:652)
	at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:1068)
	at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:26)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:218)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$1.apply(Global.scala:207)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$1.apply(Global.scala:207)
	at scala.Iterator$class.foreach(Iterator.scala:316)
	at scala.collection.mutable.ListBuffer$$anon$0.foreach(ListBuffer.scala:216)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:207)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:469)
	at scala.tools.nsc.Interpreter$Request.compile(Interpreter.scala:501)
	at scala.tools.nsc.Interpreter.interpret(Interpreter.scala:269)
	at scala.tools.nsc.InterpreterLoop.command(InterpreterLoop.scala:168)
	at scala.tools.nsc.InterpreterLoop.repl(InterpreterLoop.scala:81)
	at scala.tools.nsc.InterpreterLoop.main(InterpreterLoop.scala:187)
	at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:82)
	at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

what expected Should work. If the final application is separated via a val-binding, it works ok.
[back to overview]
Changes of this bug report
Nikolay  edited on  2006-09-24 16:49:10.0
Transferred from the contributions and assigned to Martin
Martin  edited on  2006-10-05 18:30:51.0