Open scabug opened 10 years ago
Imported From: https://issues.scala-lang.org/browse/SI-8446?orig=1 Reporter: @som-snytt Affected Versions: 2.11.0-RC3
@som-snytt said:
scala> val y = { final class X { class Y } ; val x = new X ; import x.Y ; weakTypeTag[Y] }
Today it says:
Welcome to Scala 2.13.4 (OpenJDK 64-Bit Server VM, Java 11.0.9).
Type in expressions for evaluation. Or try :help.
scala> class Y ; def y = { new Y { class Z ; def z = classOf[Z] }.z }
^
warning: inferred existential type Class[_1.Z] forSome { val _1: Y{type Z <: AnyRef; def z: Class[this.Z]} }, which cannot be expressed by wildcards, should be enabled
by making the implicit value scala.language.existentials visible.
This can be achieved by adding the import clause 'import scala.language.existentials'
or by setting the compiler option -language:existentials.
See the Scaladoc for value scala.language.existentials for a discussion
why the feature should be explicitly enabled.
java.lang.AssertionError: assertion failed:
_1.type
while compiling: <synthetic>
during phase: globalPhase=typer, enteringPhase=namer
library version: version 2.13.4
compiler version: version 2.13.4
reconstructed args: -deprecation -feature -nowarn -Wconf:cat=feature:w -Wconf:cat=deprecation:w -Wconf:cat=deprecation:ws -Wconf:cat=feature:ws -Wconf:cat=optimizer:ws -Xmaxwarns 0
last tree to typer: Ident($line3)
tree position: line 4 of <synthetic>
tree tpe: $line3.type
symbol: final package $line3
symbol definition: final package $line3 (a ModuleSymbol)
symbol package: <none>
symbol owners: package $line3
call site: lazy value $result in object $eval in package $line3
== Source file context for tree position ==
1
2 package $line3 {
3 object $eval {
4 lazy val $result = $line3.$read.INSTANCE.$iw.y
5 lazy val $print: _root_.java.lang.String = {
6 val _ = $line3.$read.INSTANCE.$iw
7
at scala.reflect.internal.SymbolTable.throwAssertionError(SymbolTable.scala:170)
at scala.reflect.internal.tpe.TypeMaps$adaptToNewRunMap$.adaptToNewRun(TypeMaps.scala:1154)
at scala.reflect.internal.tpe.TypeMaps$adaptToNewRunMap$.apply(TypeMaps.scala:1198)
at scala.reflect.internal.tpe.TypeMaps$adaptToNewRunMap$.apply(TypeMaps.scala:1126)
at scala.reflect.internal.Types$ExistentialType.mapOver(Types.scala:3215)
at scala.reflect.internal.tpe.TypeMaps$adaptToNewRunMap$.apply(TypeMaps.scala:1250)
at scala.reflect.internal.tpe.TypeMaps$adaptToNewRunMap$.apply(TypeMaps.scala:1219)
at scala.reflect.internal.Symbols$Symbol.adaptInfo(Symbols.scala:1702)
at scala.reflect.internal.Symbols$Symbol.rawInfo(Symbols.scala:1655)
at scala.tools.nsc.typechecker.Typers$Typer.isStale(Typers.scala:518)
at scala.tools.nsc.typechecker.Typers$Typer.reallyExists(Typers.scala:510)
at scala.tools.nsc.typechecker.Typers$Typer.typedSelect$1(Typers.scala:5250)
at scala.tools.nsc.typechecker.Typers$Typer.typedSelectOrSuperCall$1(Typers.scala:5375)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5937)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5993)
at scala.tools.nsc.typechecker.Typers$Typer.computeType(Typers.scala:6082)
at scala.tools.nsc.typechecker.Namers$Namer.assignTypeToTree(Namers.scala:1138)
at scala.tools.nsc.typechecker.Namers$Namer.valDefSig(Namers.scala:1750)
at scala.tools.nsc.typechecker.Namers$Namer.memberSig(Namers.scala:1938)
at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:1888)
at scala.tools.nsc.typechecker.Namers$Namer$ValTypeCompleter.completeImpl(Namers.scala:955)
at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter.complete(Namers.scala:2086)
at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter.complete$(Namers.scala:2084)
at scala.tools.nsc.typechecker.Namers$TypeCompleterBase.complete(Namers.scala:2079)
at scala.reflect.internal.Symbols$Symbol.completeInfo(Symbols.scala:1559)
at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1531)
at scala.reflect.internal.Symbols$Symbol.initialize(Symbols.scala:1720)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5589)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5993)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:6071)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$8(Typers.scala:3403)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3403)
at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:2057)
at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1933)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5903)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5993)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:6071)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$8(Typers.scala:3403)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3403)
at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:5598)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5905)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5993)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$TyperPhase.apply(Analyzer.scala:117)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:454)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$TyperPhase.run(Analyzer.scala:105)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1515)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1499)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compile(IMain.scala:741)
at scala.tools.nsc.interpreter.IMain$Request.$anonfun$compile$7(IMain.scala:971)
at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.scala:17)
at scala.tools.nsc.interpreter.IMain.$anonfun$withoutWarnings$1(IMain.scala:1406)
at scala.tools.nsc.interpreter.shell.ReplReporterImpl.withoutPrintingResults(Reporter.scala:64)
at scala.tools.nsc.interpreter.IMain.withoutWarnings(IMain.scala:103)
at scala.tools.nsc.interpreter.IMain$Request.compile(IMain.scala:971)
at scala.tools.nsc.interpreter.IMain.compile(IMain.scala:533)
at scala.tools.nsc.interpreter.IMain.doInterpret(IMain.scala:519)
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:503)
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:501)
at scala.tools.nsc.interpreter.shell.ILoop.loop$1(ILoop.scala:878)
at scala.tools.nsc.interpreter.shell.ILoop.interpretStartingWith(ILoop.scala:906)
at scala.tools.nsc.interpreter.shell.ILoop.command(ILoop.scala:433)
at scala.tools.nsc.interpreter.shell.ILoop.processLine(ILoop.scala:440)
at scala.tools.nsc.interpreter.shell.ILoop.loop(ILoop.scala:458)
at scala.tools.nsc.interpreter.shell.ILoop.run(ILoop.scala:968)
at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:87)
at scala.tools.nsc.MainGenericRunner.run$1(MainGenericRunner.scala:91)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:103)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:108)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
That entry seems to have slain the compiler. Shall I replay
your session? I can re-run each line except the last one.
[y/n]y
Nothing to replay.
and
scala> import scala.reflect.runtime.universe._
import scala.reflect.runtime.universe._
scala> val y = { final class X { class Y } ; val x = new X ; import x.Y ; weakTypeTag[Y] }
^
warning: inferred existential type reflect.runtime.universe.WeakTypeTag[x.Y] forSome { val x: AnyRef{type Y <: AnyRef} }, which cannot be expressed by wildcards, should be enabled
by making the implicit value scala.language.existentials visible.
This can be achieved by adding the import clause 'import scala.language.existentials'
or by setting the compiler option -language:existentials.
See the Scaladoc for value scala.language.existentials for a discussion
why the feature should be explicitly enabled.
java.lang.AssertionError: assertion failed:
x.type
while compiling: <synthetic>
during phase: globalPhase=typer, enteringPhase=namer
library version: version 2.13.4
compiler version: version 2.13.4
reconstructed args: -deprecation -feature -nowarn -Wconf:cat=feature:w -Wconf:cat=deprecation:w -Wconf:cat=deprecation:ws -Wconf:cat=feature:ws -Wconf:cat=optimizer:ws -Xmaxwarns 0
last tree to typer: Ident($line17)
tree position: line 4 of <synthetic>
tree tpe: $line17.type
symbol: final package $line17
symbol definition: final package $line17 (a ModuleSymbol)
symbol package: <none>
symbol owners: package $line17
call site: lazy value $result in object $eval in package $line17
== Source file context for tree position ==
1
2 package $line17 {
3 object $eval {
4 lazy val $result = $line17.$read.INSTANCE.$iw.y
5 lazy val $print: _root_.java.lang.String = {
6 val _ = $line17.$read.INSTANCE.$iw
7
at scala.reflect.internal.SymbolTable.throwAssertionError(SymbolTable.scala:170)
at scala.reflect.internal.tpe.TypeMaps$adaptToNewRunMap$.adaptToNewRun(TypeMaps.scala:1154)
at scala.reflect.internal.tpe.TypeMaps$adaptToNewRunMap$.apply(TypeMaps.scala:1198)
at scala.reflect.internal.tpe.TypeMaps$adaptToNewRunMap$.apply(TypeMaps.scala:1126)
at scala.reflect.internal.Types$ExistentialType.mapOver(Types.scala:3215)
at scala.reflect.internal.tpe.TypeMaps$adaptToNewRunMap$.apply(TypeMaps.scala:1250)
at scala.reflect.internal.tpe.TypeMaps$adaptToNewRunMap$.apply(TypeMaps.scala:1219)
at scala.reflect.internal.Symbols$Symbol.adaptInfo(Symbols.scala:1702)
at scala.reflect.internal.Symbols$Symbol.rawInfo(Symbols.scala:1655)
at scala.tools.nsc.typechecker.Typers$Typer.isStale(Typers.scala:518)
at scala.tools.nsc.typechecker.Typers$Typer.reallyExists(Typers.scala:510)
at scala.tools.nsc.typechecker.Typers$Typer.typedSelect$1(Typers.scala:5250)
at scala.tools.nsc.typechecker.Typers$Typer.typedSelectOrSuperCall$1(Typers.scala:5375)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5937)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5993)
at scala.tools.nsc.typechecker.Typers$Typer.computeType(Typers.scala:6082)
at scala.tools.nsc.typechecker.Namers$Namer.assignTypeToTree(Namers.scala:1138)
at scala.tools.nsc.typechecker.Namers$Namer.valDefSig(Namers.scala:1750)
at scala.tools.nsc.typechecker.Namers$Namer.memberSig(Namers.scala:1938)
at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:1888)
at scala.tools.nsc.typechecker.Namers$Namer$ValTypeCompleter.completeImpl(Namers.scala:955)
at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter.complete(Namers.scala:2086)
at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter.complete$(Namers.scala:2084)
at scala.tools.nsc.typechecker.Namers$TypeCompleterBase.complete(Namers.scala:2079)
at scala.reflect.internal.Symbols$Symbol.completeInfo(Symbols.scala:1559)
at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1531)
at scala.reflect.internal.Symbols$Symbol.initialize(Symbols.scala:1720)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5589)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5993)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:6071)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$8(Typers.scala:3403)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3403)
at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:2057)
at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1933)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5903)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5993)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:6071)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$8(Typers.scala:3403)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3403)
at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:5598)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5905)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5993)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$TyperPhase.apply(Analyzer.scala:117)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:454)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$TyperPhase.run(Analyzer.scala:105)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1515)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1499)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compile(IMain.scala:741)
at scala.tools.nsc.interpreter.IMain$Request.$anonfun$compile$7(IMain.scala:971)
at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.scala:17)
at scala.tools.nsc.interpreter.IMain.$anonfun$withoutWarnings$1(IMain.scala:1406)
at scala.tools.nsc.interpreter.shell.ReplReporterImpl.withoutPrintingResults(Reporter.scala:64)
at scala.tools.nsc.interpreter.IMain.withoutWarnings(IMain.scala:103)
at scala.tools.nsc.interpreter.IMain$Request.compile(IMain.scala:971)
at scala.tools.nsc.interpreter.IMain.compile(IMain.scala:533)
at scala.tools.nsc.interpreter.IMain.doInterpret(IMain.scala:519)
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:503)
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:501)
at scala.tools.nsc.interpreter.shell.ILoop.loop$1(ILoop.scala:878)
at scala.tools.nsc.interpreter.shell.ILoop.interpretStartingWith(ILoop.scala:906)
at scala.tools.nsc.interpreter.shell.ILoop.command(ILoop.scala:433)
at scala.tools.nsc.interpreter.shell.ILoop.processLine(ILoop.scala:440)
at scala.tools.nsc.interpreter.shell.ILoop.loop(ILoop.scala:458)
at scala.tools.nsc.interpreter.shell.ILoop.run(ILoop.scala:968)
at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:87)
at scala.tools.nsc.MainGenericRunner.run$1(MainGenericRunner.scala:91)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:103)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:108)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
That entry seems to have slain the compiler. Shall I replay
your session? I can re-run each line except the last one.
[y/n]n