Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Scala 2.10.0-M1
    • Component/s: Misc Compiler
    • Labels:
      None

      Description

      class Test {
        {
          val a = new {
            def m1() {
              trait T {
                def m() = ()
              }
            }
      
            def m2() {
              trait T {
                def m() = ()
              }
            }
          }
        }
      
        {
          val a = new {
            def m1() {
              trait T {
                def m() = ()
              }
            }
      
            def m2() {
              trait T {
                def m() = ()
              }
            }
          }
        }
      }
      
      error: 
           while compiling:  Test.scala
             current phase:  lambdalift
           library version:  version v2.10.0-M1-169-g76cd8c433a
          compiler version:  version v2.10.0-M1-169-g76cd8c433a
        reconstructed args:  
      
      uncaught exception during compilation: java.lang.AssertionError
      error: java.lang.AssertionError: assertion failed
        at scala.Predef$.assert(Predef.scala:146)
        at scala.reflect.internal.Scopes$Scope.enterUnique(Scopes.scala:123)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.liftDef(LambdaLift.scala:373)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.postTransform(LambdaLift.scala:383)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:462)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:1277)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:1275)
        at scala.collection.immutable.List.loop$1(List.scala:151)
        at scala.collection.immutable.List.mapConserve(List.scala:167)
        at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:1275)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:482)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:54)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:1189)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:53)
        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:269)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.preTransform(LambdaLift.scala:456)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:462)
        at scala.reflect.api.Trees$Transformer$$anonfun$transform$5.apply(Trees.scala:1175)
        at scala.reflect.api.Trees$Transformer$$anonfun$transform$5.apply(Trees.scala:1173)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:1284)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:38)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:31)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:19)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:1172)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:53)
        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:269)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.preTransform(LambdaLift.scala:456)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:462)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:1277)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:1275)
        at scala.collection.immutable.List.loop$1(List.scala:151)
        at scala.collection.immutable.List.mapConserve(List.scala:167)
        at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:1275)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:482)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:54)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:1187)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$tools$nsc$transform$TypingTransformers$TypingTransformer$$super$transform(TypingTransformers.scala:49)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$1.apply(TypingTransformers.scala:49)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$1.apply(TypingTransformers.scala:49)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:1284)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:38)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:31)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:49)
        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:269)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.preTransform(LambdaLift.scala:456)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:462)
        at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:1261)
        at scala.reflect.api.Trees$Transformer$$anonfun$transform$2.apply(Trees.scala:1159)
        at scala.reflect.api.Trees$Transformer$$anonfun$transform$2.apply(Trees.scala:1158)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:1284)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:38)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:31)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:19)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:1157)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:53)
        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:269)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.preTransform(LambdaLift.scala:456)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:462)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:1277)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:1275)
        at scala.collection.immutable.List.loop$1(List.scala:151)
        at scala.collection.immutable.List.mapConserve(List.scala:167)
        at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:1275)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:482)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:54)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:1189)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:53)
        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:269)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.preTransform(LambdaLift.scala:456)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:462)
        at scala.reflect.api.Trees$Transformer$$anonfun$transform$4.apply(Trees.scala:1169)
        at scala.reflect.api.Trees$Transformer$$anonfun$transform$4.apply(Trees.scala:1168)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:1284)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:38)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:31)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:19)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:1167)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:53)
        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:269)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.preTransform(LambdaLift.scala:456)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:462)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:1277)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:1275)
        at scala.collection.immutable.List.loop$1(List.scala:151)
        at scala.collection.immutable.List.mapConserve(List.scala:167)
        at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:1275)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:482)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:54)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:1189)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:53)
        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:269)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.preTransform(LambdaLift.scala:456)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:462)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1$$anonfun$apply$2.apply(Trees.scala:1276)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1$$anonfun$apply$2.apply(Trees.scala:1276)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:1284)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:38)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:31)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:19)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:1276)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:1275)
        at scala.collection.immutable.List.loop$1(List.scala:151)
        at scala.collection.immutable.List.mapConserve(List.scala:167)
        at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:1275)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:482)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:54)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:1187)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$tools$nsc$transform$TypingTransformers$TypingTransformer$$super$transform(TypingTransformers.scala:49)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$1.apply(TypingTransformers.scala:49)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$1.apply(TypingTransformers.scala:49)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:1284)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:38)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:31)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:49)
        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:269)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.preTransform(LambdaLift.scala:456)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:462)
        at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:1261)
        at scala.reflect.api.Trees$Transformer$$anonfun$transform$2.apply(Trees.scala:1159)
        at scala.reflect.api.Trees$Transformer$$anonfun$transform$2.apply(Trees.scala:1158)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:1284)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:38)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:31)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:19)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:1157)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:53)
        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:269)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.preTransform(LambdaLift.scala:456)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:462)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:1277)
        at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:1275)
        at scala.collection.immutable.List.loop$1(List.scala:151)
        at scala.collection.immutable.List.mapConserve(List.scala:167)
        at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:1275)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:482)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:54)
        at scala.reflect.api.Trees$Transformer$$anonfun$transform$1.apply(Trees.scala:1153)
        at scala.reflect.api.Trees$Transformer$$anonfun$transform$1.apply(Trees.scala:1153)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:1284)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:38)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:31)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:19)
        at scala.reflect.api.Trees$Transformer.transform(Trees.scala:1152)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$tools$nsc$transform$TypingTransformers$TypingTransformer$$super$transform(TypingTransformers.scala:49)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$2.apply(TypingTransformers.scala:51)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$2.apply(TypingTransformers.scala:51)
        at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:1284)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:38)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:31)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:51)
        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:269)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.preTransform(LambdaLift.scala:456)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:462)
        at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:223)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.scala$tools$nsc$transform$LambdaLift$LambdaLifter$$super$transformUnit(LambdaLift.scala:487)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter$$anonfun$transformUnit$1.apply$mcV$sp(LambdaLift.scala:487)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter$$anonfun$transformUnit$1.apply(LambdaLift.scala:487)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter$$anonfun$transformUnit$1.apply(LambdaLift.scala:487)
        at scala.reflect.internal.SymbolTable.atPhase(SymbolTable.scala:120)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformUnit(LambdaLift.scala:487)
        at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
        at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:408)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:374)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:368)
        at scala.collection.Iterator$class.foreach(Iterator.scala:687)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1112)
        at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:368)
        at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1196)
        at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1169)
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:1163)
        at scala.tools.nsc.Global$Run.compile(Global.scala:1293)
        at scala.tools.nsc.Driver.doCompile(Driver.scala:31)
        at scala.tools.nsc.Main$.doCompile(Main.scala:81)
        at scala.tools.nsc.Driver.process(Driver.scala:52)
        at scala.tools.nsc.Driver.main(Driver.scala:65)
        at scala.tools.nsc.Main.main(Main.scala)
      

        Activity

        Hide
        Christopher Vogt added a comment -

        simpler reproduce code:

        class Test{
            def a() {
              trait T {
                def x() = ()
              }
            }
            def b() {
              trait T {
                def y() = ()
              }
            }
            def c() {
              trait T {
                def z() = ()
              }
            }
        }
        

        Traits require identical names to reproduce.

        Show
        Christopher Vogt added a comment - simpler reproduce code: class Test{ def a() { trait T { def x() = () } } def b() { trait T { def y() = () } } def c() { trait T { def z() = () } } } Traits require identical names to reproduce.
        Hide
        Christopher Vogt added a comment -

        does not crash in 2.9.1, crash reproduced in trunk (fb5f42648a61de2cdfc318c341ab28ea5662ca20)

        Show
        Christopher Vogt added a comment - does not crash in 2.9.1, crash reproduced in trunk (fb5f42648a61de2cdfc318c341ab28ea5662ca20)
        Hide
        Paul Phillips added a comment -

        I introduced this no doubt in 5cbd7d06eb . I think crashing is a feature - look at the compilation products in 2.9.1. It may not crash but it's hard to be real confident it's doing the right thing:

        Test$T$1.class
        Test$T$2$class.class
        Test$T$2.class
        Test$T$3.class
        Test$T$class$1.class
        Test$T$class$2.class
        Test$T$class$3.class
        Test$T$class.class
        Test.class
        

        Test$T$2$class and Test$T$class$2 ! And look inside:

        // this is one of them
        public static void y(Test$T$2);
        // this is the other one
        public static void z(Test$T$2);

        Show
        Paul Phillips added a comment - I introduced this no doubt in 5cbd7d06eb . I think crashing is a feature - look at the compilation products in 2.9.1. It may not crash but it's hard to be real confident it's doing the right thing: Test$T$1.class Test$T$2$class.class Test$T$2.class Test$T$3.class Test$T$class$1.class Test$T$class$2.class Test$T$class$3.class Test$T$class.class Test.class Test$T$2$class and Test$T$class$2 ! And look inside: // this is one of them public static void y(Test$T$2); // this is the other one public static void z(Test$T$2);
        Hide
        Paul Phillips added a comment -

        Or, maybe it's too late for me and I'm blending the classfiles from two compiles. I thought all my more recent ones crashed. Never mind, nothing to see here...

        Show
        Paul Phillips added a comment - Or, maybe it's too late for me and I'm blending the classfiles from two compiles. I thought all my more recent ones crashed. Never mind, nothing to see here...
        Hide
        Paul Phillips added a comment -

        Thanks for the legwork everyone.

        Show
        Paul Phillips added a comment - Thanks for the legwork everyone.
        Hide
        Paul Phillips added a comment -

        eb8556ca66

        Show
        Paul Phillips added a comment - eb8556ca66

          People

          • Assignee:
            Paul Phillips
            Reporter:
            Eugene Burmako
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development