Scala Programming Language
  1. Scala Programming Language
  2. SI-5384

Superconstructor arguments in the presence of an implicit parameter list crash the compiler

    Details

      Description

      Reduced by Paul:

      class A(x: String, y: Int)(implicit o: String)
      class B(implicit o: String) extends A(y = 5, x = "a")
      

      Original bug report:

      class A[E: Manifest](val x: Unit = (), y: Unit)
      class B[E: Manifest] extends A[E](y = ())
      

      Crash:

      exception when typing B.this.o
      value o in class B cannot be accessed in B in file null
      scala.reflect.internal.Types$TypeError: value o in class B cannot be accessed in B
      	at scala.tools.nsc.typechecker.Contexts$Context.issue(Contexts.scala:363)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedSelect$1(Typers.scala:4324)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4903)
      	at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:751)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5015)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$66.apply(Typers.scala:2650)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:2650)
      	at scala.tools.nsc.typechecker.Typers$Typer.loop$1(Typers.scala:2669)
      	at scala.tools.nsc.typechecker.Typers$Typer.loop$1(Typers.scala:2672)
      	at scala.tools.nsc.typechecker.Typers$Typer.loop$1(Typers.scala:2672)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedArgs(Typers.scala:2675)
      	at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:2916)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4110)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4842)
      	at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:751)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5015)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:2135)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typed1$3.apply(Typers.scala:4695)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4694)
      	at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:751)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5015)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2540)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$64$$anonfun$65.apply(Typers.scala:2636)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$64$$anonfun$65.apply(Typers.scala:2636)
      	at scala.collection.immutable.List.loop$1(List.scala:163)
      	at scala.collection.immutable.List.mapConserve(List.scala:179)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$64.apply(Typers.scala:2636)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2635)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:2134)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typed1$3.apply(Typers.scala:4695)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4694)
      	at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:751)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5015)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5073)
      	at scala.tools.nsc.typechecker.Typers$Typer.typePrimaryConstrBody(Typers.scala:1319)
      	at scala.tools.nsc.typechecker.Typers$Typer.parentTypes(Typers.scala:1414)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$43.apply(Typers.scala:1579)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1578)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4654)
      	at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:751)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5015)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2540)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$64$$anonfun$65.apply(Typers.scala:2636)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$64$$anonfun$65.apply(Typers.scala:2636)
      	at scala.collection.immutable.List.loop$1(List.scala:163)
      	at scala.collection.immutable.List.mapConserve(List.scala:179)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$64.apply(Typers.scala:2636)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2635)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4650)
      	at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:751)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5015)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5073)
      	at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anonfun$transform$2.apply(Erasure.scala:1146)
      	at scala.tools.nsc.transform.Erasure$ErasureTransformer.transform(Erasure.scala:1142)
      	at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:228)
      	at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
      	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:432)
      	at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:398)
      	at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:392)
      	at scala.collection.Iterator$class.foreach(Iterator.scala:697)
      	at scala.collection.AbstractIterator.foreach(Iterator.scala:1124)
      	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:392)
      	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1336)
      	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1309)
      	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1303)
      	at scala.tools.nsc.Global$Run.compile(Global.scala:1436)
      	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)
      error: unrecoverable error
      exception when typing B.super.<init>("a", 5, B.this.o)
      exception when typing {
        val x$1: Int(5) = 5;
        val x$2: String("a") = "a";
        B.super.<init>("a", 5, B.this.o)
      }
      exception when typing {
      ...
      

        Activity

        Hide
        Robin Green added a comment -

        The error messages from 2.9.1 and the 2.10 nightly build are different to the 2.8.1 error above - here is the nightly build error:

        error: EmptyScope.enter
        exception when typing B.this.<error>
        exception when typing B.super.<init>(x$2, x$1, B.this.<error>)
        exception when typing {
          val x$1: scala.runtime.BoxedUnit = ();
          val x$2: scala.runtime.BoxedUnit = A.init$default$1();
          B.super.<init>(x$2, x$1, B.this.<error>)
        }
        exception when typing {
          {
            val x$1: scala.runtime.BoxedUnit = ();
            val x$2: scala.runtime.BoxedUnit = A.init$default$1();
            B.super.<init>(x$2, x$1, B.this.<error>)
          };
          ()
        }
        exception when typing class B extends A with ScalaObject {
          implicit <paramaccessor> private[this] val evidence$2: scala.reflect.Manifest = _;
          def <init>(implicit evidence$2: scala.reflect.Manifest): B = {
            {
              val x$1: scala.runtime.BoxedUnit = ();
              val x$2: scala.runtime.BoxedUnit = A.init$default$1();
              B.super.<init>(x$2, x$1, B.this.evidence$2)
            };
            ()
          }
        }
        exception when typing package <empty> {
          class A extends Object with ScalaObject {
            <paramaccessor> private[this] val x: scala.runtime.BoxedUnit = _;
            <stable> <accessor> <paramaccessor> def x(): Unit = A.this.x;
            <paramaccessor> private[this] val y: scala.runtime.BoxedUnit = _;
            implicit <paramaccessor> private[this] val evidence$1: scala.reflect.Manifest = _;
            def <init>(x: scala.runtime.BoxedUnit = (), y: scala.runtime.BoxedUnit, evidence$1: scala.reflect.Manifest): A = {
              A.super.<init>();
              ()
            }
          };
          final <synthetic> object A extends Object with ScalaObject {
            def <init>(): object A = {
              A.super.<init>();
              ()
            };
            <synthetic> def init$default$1(): Unit = ()
          };
          class B extends A with ScalaObject {
            implicit <paramaccessor> private[this] val evidence$2: scala.reflect.Manifest = _;
            def <init>(implicit evidence$2: scala.reflect.Manifest): B = {
              {
                val x$1: scala.runtime.BoxedUnit = ();
                val x$2: scala.runtime.BoxedUnit = A.init$default$1();
                B.super.<init>(x$2, x$1, B.this.evidence$2)
              };
              ()
            }
          }
        }
        unhandled exception while transforming Bug.scala
        error: scala.reflect.internal.FatalError: EmptyScope.enter
                at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:36)
                at scala.tools.nsc.Global.abort(Global.scala:170)
                at scala.reflect.internal.Scopes$EmptyScope$.enter(Scopes.scala:344)
                at scala.reflect.internal.Scopes$Scope.enter(Scopes.scala:119)
                at scala.reflect.internal.Symbols$Symbol.setInfoAndEnter(Symbols.scala:1001)
                at scala.tools.nsc.typechecker.Implicits$class.memberWildcardType(Implicits.scala:196)
                at scala.tools.nsc.transform.Erasure.memberWildcardType(Erasure.scala:15)
                at scala.tools.nsc.typechecker.Implicits$HasMember$$anonfun$apply$1.apply(Implicits.scala:206)
                at scala.tools.nsc.typechecker.Implicits$HasMember$$anonfun$apply$1.apply(Implicits.scala:206)
                at scala.collection.mutable.MapLike$class.getOrElseUpdate(MapLike.scala:169)
                at scala.collection.mutable.AbstractMap.getOrElseUpdate(Map.scala:91)
                at scala.tools.nsc.typechecker.Implicits$HasMember$.apply(Implicits.scala:206)
                at scala.tools.nsc.typechecker.Typers$Typer.adaptToMemberWithArgs(Typers.scala:1104)
                at scala.tools.nsc.typechecker.Typers$Typer.liftedTree1$1(Typers.scala:3731)
                at scala.tools.nsc.typechecker.Typers$Typer.typedSelect$1(Typers.scala:3731)
                at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4288)
                at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:599)
                at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4386)
                at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:2175)
                at scala.tools.nsc.typechecker.Typers$Typer.loop$1(Typers.scala:2194)
                at scala.tools.nsc.typechecker.Typers$Typer.loop$1(Typers.scala:2196)
                at scala.tools.nsc.typechecker.Typers$Typer.loop$1(Typers.scala:2196)
                at scala.tools.nsc.typechecker.Typers$Typer.typedArgs(Typers.scala:2199)
                at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:2427)
                at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:3457)
                at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4227)
                at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:599)
                at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4386)
                at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:1887)
                at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4093)
                at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:599)
                at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4386)
                at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2078)
                at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$25.apply(Typers.scala:2168)
                at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$25.apply(Typers.scala:2168)
                at scala.collection.immutable.List.loop$1(List.scala:150)
                at scala.collection.immutable.List.mapConserve(List.scala:166)
                at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2168)
                at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:1886)
                at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4093)
                at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:599)
                at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4386)
                at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4445)
                at scala.tools.nsc.typechecker.Typers$Typer.typePrimaryConstrBody(Typers.scala:1137)
                at scala.tools.nsc.typechecker.Typers$Typer.parentTypes(Typers.scala:1204)
                at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1364)
                at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4052)
                at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:599)
                at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4386)
                at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2078)
                at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$25.apply(Typers.scala:2168)
                at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$25.apply(Typers.scala:2168)
                at scala.collection.immutable.List.loop$1(List.scala:150)
                at scala.collection.immutable.List.mapConserve(List.scala:166)
                at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2168)
                at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4048)
                at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:599)
                at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4386)
                at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4445)
                at scala.tools.nsc.transform.Erasure$ErasureTransformer.transform(Erasure.scala:1064)
                at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:225)
                at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
                at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:386)
                at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:355)
                at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:349)
                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:349)
                at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1130)
                at scala.tools.nsc.Global$Run.compileSources(Global.scala:1105)
                at scala.tools.nsc.Global$Run.compile(Global.scala:1227)
                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)
        
        error: fatal error: EmptyScope.enter
        
        Show
        Robin Green added a comment - The error messages from 2.9.1 and the 2.10 nightly build are different to the 2.8.1 error above - here is the nightly build error: error: EmptyScope.enter exception when typing B.this.<error> exception when typing B.super.<init>(x$2, x$1, B.this.<error>) exception when typing { val x$1: scala.runtime.BoxedUnit = (); val x$2: scala.runtime.BoxedUnit = A.init$default$1(); B.super.<init>(x$2, x$1, B.this.<error>) } exception when typing { { val x$1: scala.runtime.BoxedUnit = (); val x$2: scala.runtime.BoxedUnit = A.init$default$1(); B.super.<init>(x$2, x$1, B.this.<error>) }; () } exception when typing class B extends A with ScalaObject { implicit <paramaccessor> private[this] val evidence$2: scala.reflect.Manifest = _; def <init>(implicit evidence$2: scala.reflect.Manifest): B = { { val x$1: scala.runtime.BoxedUnit = (); val x$2: scala.runtime.BoxedUnit = A.init$default$1(); B.super.<init>(x$2, x$1, B.this.evidence$2) }; () } } exception when typing package <empty> { class A extends Object with ScalaObject { <paramaccessor> private[this] val x: scala.runtime.BoxedUnit = _; <stable> <accessor> <paramaccessor> def x(): Unit = A.this.x; <paramaccessor> private[this] val y: scala.runtime.BoxedUnit = _; implicit <paramaccessor> private[this] val evidence$1: scala.reflect.Manifest = _; def <init>(x: scala.runtime.BoxedUnit = (), y: scala.runtime.BoxedUnit, evidence$1: scala.reflect.Manifest): A = { A.super.<init>(); () } }; final <synthetic> object A extends Object with ScalaObject { def <init>(): object A = { A.super.<init>(); () }; <synthetic> def init$default$1(): Unit = () }; class B extends A with ScalaObject { implicit <paramaccessor> private[this] val evidence$2: scala.reflect.Manifest = _; def <init>(implicit evidence$2: scala.reflect.Manifest): B = { { val x$1: scala.runtime.BoxedUnit = (); val x$2: scala.runtime.BoxedUnit = A.init$default$1(); B.super.<init>(x$2, x$1, B.this.evidence$2) }; () } } } unhandled exception while transforming Bug.scala error: scala.reflect.internal.FatalError: EmptyScope.enter at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:36) at scala.tools.nsc.Global.abort(Global.scala:170) at scala.reflect.internal.Scopes$EmptyScope$.enter(Scopes.scala:344) at scala.reflect.internal.Scopes$Scope.enter(Scopes.scala:119) at scala.reflect.internal.Symbols$Symbol.setInfoAndEnter(Symbols.scala:1001) at scala.tools.nsc.typechecker.Implicits$class.memberWildcardType(Implicits.scala:196) at scala.tools.nsc.transform.Erasure.memberWildcardType(Erasure.scala:15) at scala.tools.nsc.typechecker.Implicits$HasMember$$anonfun$apply$1.apply(Implicits.scala:206) at scala.tools.nsc.typechecker.Implicits$HasMember$$anonfun$apply$1.apply(Implicits.scala:206) at scala.collection.mutable.MapLike$class.getOrElseUpdate(MapLike.scala:169) at scala.collection.mutable.AbstractMap.getOrElseUpdate(Map.scala:91) at scala.tools.nsc.typechecker.Implicits$HasMember$.apply(Implicits.scala:206) at scala.tools.nsc.typechecker.Typers$Typer.adaptToMemberWithArgs(Typers.scala:1104) at scala.tools.nsc.typechecker.Typers$Typer.liftedTree1$1(Typers.scala:3731) at scala.tools.nsc.typechecker.Typers$Typer.typedSelect$1(Typers.scala:3731) at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4288) at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:599) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4386) at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:2175) at scala.tools.nsc.typechecker.Typers$Typer.loop$1(Typers.scala:2194) at scala.tools.nsc.typechecker.Typers$Typer.loop$1(Typers.scala:2196) at scala.tools.nsc.typechecker.Typers$Typer.loop$1(Typers.scala:2196) at scala.tools.nsc.typechecker.Typers$Typer.typedArgs(Typers.scala:2199) at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:2427) at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:3457) at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4227) at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:599) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4386) at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:1887) at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4093) at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:599) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4386) at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2078) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$25.apply(Typers.scala:2168) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$25.apply(Typers.scala:2168) at scala.collection.immutable.List.loop$1(List.scala:150) at scala.collection.immutable.List.mapConserve(List.scala:166) at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2168) at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:1886) at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4093) at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:599) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4386) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4445) at scala.tools.nsc.typechecker.Typers$Typer.typePrimaryConstrBody(Typers.scala:1137) at scala.tools.nsc.typechecker.Typers$Typer.parentTypes(Typers.scala:1204) at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1364) at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4052) at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:599) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4386) at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2078) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$25.apply(Typers.scala:2168) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$25.apply(Typers.scala:2168) at scala.collection.immutable.List.loop$1(List.scala:150) at scala.collection.immutable.List.mapConserve(List.scala:166) at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2168) at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4048) at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:599) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4386) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4445) at scala.tools.nsc.transform.Erasure$ErasureTransformer.transform(Erasure.scala:1064) at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:225) at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30) at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:386) at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:355) at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:349) 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:349) at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1130) at scala.tools.nsc.Global$Run.compileSources(Global.scala:1105) at scala.tools.nsc.Global$Run.compile(Global.scala:1227) 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) error: fatal error: EmptyScope.enter
        Hide
        Robin Green added a comment -

        A workaround that works for all versions is to reorder the formal parameters of class A:

        class A[E: Manifest](y: Unit, val x: Unit = ())
        
        class B[E: Manifest] extends A[E](y = ())
        
        Show
        Robin Green added a comment - A workaround that works for all versions is to reorder the formal parameters of class A: class A[E: Manifest](y: Unit, val x: Unit = ()) class B[E: Manifest] extends A[E](y = ())
        Hide
        Paul Phillips added a comment -

        To narrow this a bit, neither manifests nor default arguments are implicated directly. It is the reordering of superconstructor arguments in the presence of an implicit parameter list.

        class A(x: String, y: Int)(implicit o: String)
        class B(implicit o: String) extends A(y = 5, x = "a")
        // Note that these don't crash:
        // class B(implicit o: String) extends A(y = 5, x = "a")(o)
        // class B(implicit o: String) extends A(x = "a", y = 5)
        
        Show
        Paul Phillips added a comment - To narrow this a bit, neither manifests nor default arguments are implicated directly. It is the reordering of superconstructor arguments in the presence of an implicit parameter list. class A(x: String, y: Int)(implicit o: String) class B(implicit o: String) extends A(y = 5, x = "a") // Note that these don't crash: // class B(implicit o: String) extends A(y = 5, x = "a")(o) // class B(implicit o: String) extends A(x = "a", y = 5)
        Show
        Lukas Rytz added a comment - fixed in https://github.com/scala/scala/commit/2d33c00ec0fd0b4a4b863ac02630cb87bc71c53d

          People

          • Assignee:
            Lukas Rytz
            Reporter:
            Robin Green
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development