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

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

Closed
scabug opened this issue Jun 21, 2012 · 4 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Jun 21, 2012

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)
@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 21, 2012

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 21, 2012

@adriaanm said:
Lukas, could you have a look please?

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jul 13, 2012

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jul 16, 2012

@lrytz said:
fixed in [https://github.com/scala/scala/commit/2c5890b3a7aa227643fde86ba72820a8016bc453]

@scabug scabug closed this Jul 16, 2012
@scabug scabug added this to the 2.10.0-M5 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.