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

2.10 regression: compiler crash (Unsound substitution) with "case class C[T]; class C"

    Details

      Description

      incorrect code of course, but:

      % cat O.scala 
      object O { case class C[T]; class C }
      % scalac29 -version        
      Scala compiler version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL
      % scalac29 O.scala
      O.scala:1: warning: case classes without a parameter list have been deprecated;
      use either case objects or case classes with `()' as parameter list.
      object O { case class C[T]; class C }
                                ^
      O.scala:1: error: C is already defined as case class C
      object O { case class C[T]; class C }
                                        ^
      one warning found
      one error found
      % scalac210 -version
      Scala compiler version 2.10.0-M4 -- Copyright 2002-2011, LAMP/EPFL
      % scalac210 O.scala 
      O.scala:1: warning: case classes without a parameter list have been deprecated;
      use either case objects or case classes with `()' as parameter list.
      object O { case class C[T]; class C }
                                ^
      O.scala:1: error: C is already defined as case class C
      object O { case class C[T]; class C }
                                        ^
      error: 
           while compiling: O.scala
              during phase: typer
           library version: version 2.10.0-M4
          compiler version: version 2.10.0-M4
        reconstructed args: -deprecation -unchecked
      
        last tree to typer: term copy
                    symbol: method copy in class C (flags: <method> <synthetic>)
         symbol definition: def copy: <?>
             symbol owners: method copy -> class C -> object O -> package <empty>
            context owners: constructor C -> class C -> object O -> package <empty>
      
      == Enclosing template or block ==
      
      Apply( // def <init>(): Object in class Object, tree.tpe=Object
        C.super."<init>" // def <init>(): Object in class Object, tree.tpe=()Object
        Nil
      )
      
      uncaught exception during compilation: java.lang.AssertionError
      error: java.lang.AssertionError: assertion failed: Unsound substitution from List() to List(type T)
      	at scala.Predef$.assert(Predef.scala:162)
      	at scala.reflect.internal.Types$SubstMap.<init>(Types.scala:4392)
      	at scala.reflect.internal.Types$SubstSymMap.<init>(Types.scala:4445)
      	at scala.tools.nsc.typechecker.Namers$Namer.scala$tools$nsc$typechecker$Namers$Namer$$completeCopyMethod$1(Namers.scala:514)
      	at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$enterCopyMethodOrGetter$1.apply(Namers.scala:529)
      	at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$enterCopyMethodOrGetter$1.apply(Namers.scala:527)
      	at scala.Function1$class.apply$mcVL$sp(Function1.scala:39)
      	at scala.runtime.AbstractFunction1.apply$mcVL$sp(AbstractFunction1.scala:12)
      	at scala.tools.nsc.typechecker.Namers$$anon$1.completeImpl(Namers.scala:1468)
      	at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter$class.complete(Namers.scala:1476)
      	at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:1466)
      	at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1209)
      	at scala.reflect.internal.Symbols$Symbol.initialize(Symbols.scala:1341)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4723)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5113)
      	at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2592)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$addSynthetics$1$1$$anonfun$apply$35.apply(Typers.scala:2651)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$addSynthetics$1$1$$anonfun$apply$35.apply(Typers.scala:2650)
      	at scala.Option.foreach(Option.scala:236)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$addSynthetics$1$1.apply(Typers.scala:2650)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$addSynthetics$1$1.apply(Typers.scala:2649)
      	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
      	at scala.collection.immutable.List.foreach(List.scala:77)
      	at scala.reflect.internal.Scopes$Scope.foreach(Scopes.scala:308)
      	at scala.tools.nsc.typechecker.Typers$Typer.addSynthetics$1(Typers.scala:2649)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2696)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1746)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$40.apply(Typers.scala:1609)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$40.apply(Typers.scala:1609)
      	at scala.tools.nsc.typechecker.Typers$Typer.typerReportAnyContextErrors(Typers.scala:515)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1608)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4736)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5113)
      	at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2592)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$61$$anonfun$62.apply(Typers.scala:2688)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$61$$anonfun$62.apply(Typers.scala:2688)
      	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$61.apply(Typers.scala:2688)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$61.apply(Typers.scala:2687)
      	at scala.tools.nsc.typechecker.Typers$Typer.withSavedContext(Typers.scala:524)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2687)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1746)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$41.apply(Typers.scala:1654)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$41.apply(Typers.scala:1654)
      	at scala.tools.nsc.typechecker.Typers$Typer.typerReportAnyContextErrors(Typers.scala:515)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1653)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4739)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5113)
      	at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2592)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$61$$anonfun$62.apply(Typers.scala:2688)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$61$$anonfun$62.apply(Typers.scala:2688)
      	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$61.apply(Typers.scala:2688)
      	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$61.apply(Typers.scala:2687)
      	at scala.tools.nsc.typechecker.Typers$Typer.withSavedContext(Typers.scala:524)
      	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2687)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4732)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5113)
      	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5171)
      	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:97)
      	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:459)
      	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:89)
      	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:89)
      	at scala.collection.Iterator$class.foreach(Iterator.scala:724)
      	at scala.collection.AbstractIterator.foreach(Iterator.scala:1152)
      	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:89)
      	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1574)
      	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1548)
      	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1544)
      	at scala.tools.nsc.Global$Run.compile(Global.scala:1654)
      	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
        Adriaan Moors added a comment -

        Lukas, could you have a look please?

        Show
        Adriaan Moors added a comment - Lukas, could you have a look please?
        Show
        Adriaan Moors added a comment - https://github.com/scala/scala/pull/897
        Show
        Lukas Rytz added a comment - fixed in https://github.com/scala/scala/commit/2c5890b3a7aa227643fde86ba72820a8016bc453

          People

          • Assignee:
            Lukas Rytz
            Reporter:
            Seth Tisue
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development