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

Scalac crashes when searching for an implicit value of a dependent type of an existential type #10040

Closed
scabug opened this issue Nov 10, 2016 · 2 comments

Comments

@scabug
Copy link

scabug commented Nov 10, 2016

Welcome to Scala 2.12.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_102).
Type in expressions for evaluation. Or try :help.

scala> :paste
// Entering paste mode (ctrl-D to finish)

object Crash {

  type CovariantConverter[+Output0, -Input0] = Converter {
    type Output <: Output0
    type Input >: Input0
  }

  sealed trait Converter {
    type Output
    type Input

    type Covariant = CovariantConverter[Output, Input]

  }

  final class FinalConverter[Output0, Input0] extends Converter {
    type Output = Output0
    type Input = Input0
  }

  type ConverterPair[Head <: Converter, Tail <: Converter] =
    FinalConverter[Either[head.Output, tail.Output], Either[head.Input, tail.Input]] forSome {
      val head: Head
      val tail: Tail
    }

  implicitly[(ConverterPair[Converter, Converter])#Covariant =:= (ConverterPair[Converter, Converter])#Covariant]

}

// Exiting paste mode, now interpreting.

ReplGlobal.abort: Cannot set name of RefinementClassSymbol to <root>.<refinement>
error:
  Cannot set name of RefinementClassSymbol to <root>.<refinement>
     while compiling: <console>
        during phase: typer
     library version: version 2.12.0
    compiler version: version 2.12.0
  reconstructed args: -classpath /private/tmp/target/scala-2.12/classes:/Users/twer/.ivy2/cache/org.scala-lang/scala-compiler/jars/scala-compiler-2.12.0.jar:/Users/twer/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.12.0.jar:/Users/twer/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.5.jar:/Users/twer/.ivy2/cache/jline/jline/jars/jline-2.14.1.jar -bootclasspath /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre/classes:/Users/twer/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.12.0.jar -Yrepl-sync

  last tree to typer: Select(This(object Predef), =:=)
       tree position: line 37 of <console>
            tree tpe: =:=.type
              symbol: object =:= in object Predef
   symbol definition: object =:= (a ModuleSymbol)
      symbol package: scala
       symbol owners: object =:= -> object Predef
           call site: object Crash in package $line3

<Cannot read source file>
ReplGlobal.abort: Cannot set name of RefinementClassSymbol to <refinement>
error: Cannot set name of RefinementClassSymbol to <refinement>
scala.reflect.internal.FatalError: Cannot set name of RefinementClassSymbol to <refinement>
	at scala.reflect.internal.Reporting.abort(Reporting.scala:61)
	at scala.reflect.internal.Reporting.abort$(Reporting.scala:57)
	at scala.tools.nsc.interpreter.IMain$$anon$1.scala$tools$nsc$interpreter$ReplGlobal$$super$abort(IMain.scala:242)
	at scala.tools.nsc.interpreter.ReplGlobal.abort(ReplGlobal.scala:20)
	at scala.tools.nsc.interpreter.ReplGlobal.abort$(ReplGlobal.scala:18)
	at scala.tools.nsc.interpreter.IMain$$anon$1.abort(IMain.scala:242)
	at scala.reflect.internal.Symbols$RefinementClassSymbol.name_$eq(Symbols.scala:3379)
	at scala.tools.nsc.typechecker.TypeDiagnostics$TypeDiag.restoreName(TypeDiagnostics.scala:315)
	at scala.tools.nsc.typechecker.TypeDiagnostics.$anonfun$withDisambiguation$3(TypeDiagnostics.scala:407)
	at scala.tools.nsc.typechecker.TypeDiagnostics.$anonfun$withDisambiguation$2(TypeDiagnostics.scala:407)
	at scala.util.control.Exception$Finally.invoke(Exception.scala:196)
	at scala.util.control.Exception$Catch.$anonfun$apply$1(Exception.scala:229)
	at scala.util.control.Exception$Catch.$anonfun$apply$1$adapted(Exception.scala:229)
	at scala.util.control.Exception$Catch.apply(Exception.scala:229)
	at scala.tools.nsc.typechecker.TypeDiagnostics.withDisambiguation$(TypeDiagnostics.scala:407)
	at scala.tools.nsc.interpreter.ReplGlobal$$anon$1.withDisambiguation(ReplGlobal.scala:23)
	at scala.tools.nsc.typechecker.TypeDiagnostics.foundReqMsg(TypeDiagnostics.scala:286)
	at scala.tools.nsc.typechecker.TypeDiagnostics.foundReqMsg$(TypeDiagnostics.scala:281)
	at scala.tools.nsc.interpreter.ReplGlobal$$anon$1.foundReqMsg(ReplGlobal.scala:23)
	at scala.tools.nsc.typechecker.ContextErrors$ErrorUtils$.typeErrorMsg(ContextErrors.scala:108)
	at scala.tools.nsc.typechecker.ContextErrors$TyperContextErrors$TyperErrorGen$.AdaptTypeError(ContextErrors.scala:219)
	at scala.tools.nsc.typechecker.Typers$Typer.adaptMismatchedSkolems$1(Typers.scala:1044)
	at scala.tools.nsc.typechecker.Typers$Typer.lastTry$1(Typers.scala:1055)
	at scala.tools.nsc.typechecker.Typers$Typer.adaptExprNotFunMode$1(Typers.scala:1105)
	at scala.tools.nsc.typechecker.Typers$Typer.vanillaAdapt$1(Typers.scala:1151)
	at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1195)
	at scala.tools.nsc.typechecker.Typers$Typer.instantiate(Typers.scala:1207)
	at scala.tools.nsc.typechecker.Typers$Typer.instantiatePossiblyExpectingUnit(Typers.scala:1226)
	at scala.tools.nsc.typechecker.Typers$Typer.vanillaAdapt$1(Typers.scala:1142)
	at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1195)
	at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1168)
	at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1188)
	at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit1(Implicits.scala:671)
	at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.typedImplicit0(Implicits.scala:608)
	at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.scala$tools$nsc$typechecker$Implicits$ImplicitSearch$$typedImplicit(Implicits.scala:477)
	at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation.rankImplicits(Implicits.scala:927)
	at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation.findBest(Implicits.scala:955)
	at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1012)
	at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1398)
	at scala.tools.nsc.typechecker.Implicits.inferImplicit(Implicits.scala:92)
	at scala.tools.nsc.typechecker.Implicits.inferImplicit$(Implicits.scala:81)
	at scala.tools.nsc.interpreter.ReplGlobal$$anon$1.inferImplicit(ReplGlobal.scala:23)
	at scala.tools.nsc.typechecker.Implicits.inferImplicitFor(Implicits.scala:39)
	at scala.tools.nsc.typechecker.Implicits.inferImplicitFor$(Implicits.scala:38)
	at scala.tools.nsc.interpreter.ReplGlobal$$anon$1.inferImplicitFor(ReplGlobal.scala:23)
	at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$applyImplicitArgs$2(Typers.scala:172)
	at scala.tools.nsc.typechecker.Typers$Typer.applyImplicitArgs(Typers.scala:165)
	at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$adapt$1(Typers.scala:874)
	at scala.tools.nsc.typechecker.Typers$Typer.adaptToImplicitMethod$1(Typers.scala:481)
	at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1191)
	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5514)
	at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5530)
	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5474)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5478)
	at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5559)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:3058)
	at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$8(Typers.scala:3187)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3187)
	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1975)
	at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1846)
	at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5414)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5463)
	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5500)
	at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5530)
	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5474)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5478)
	at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5559)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:3058)
	at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$8(Typers.scala:3187)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3187)
	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1975)
	at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1846)
	at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5414)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5463)
	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5500)
	at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5530)
	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5474)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5478)
	at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5559)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:3058)
	at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$8(Typers.scala:3187)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3187)
	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1975)
	at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1846)
	at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5414)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5463)
	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5500)
	at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5530)
	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5474)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5478)
	at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5559)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:3058)
	at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$8(Typers.scala:3187)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3187)
	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1975)
	at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1846)
	at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5414)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5463)
	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5500)
	at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5530)
	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5474)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5478)
	at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5559)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:3058)
	at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$8(Typers.scala:3187)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3187)
	at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:5113)
	at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5416)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5463)
	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5500)
	at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5530)
	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5474)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5478)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5555)
	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:102)
	at scala.tools.nsc.Global$GlobalPhase.$anonfun$applyPhase$1(Global.scala:402)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:395)
	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.$anonfun$run$1(Analyzer.scala:94)
	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.$anonfun$run$1$adapted(Analyzer.scala:93)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:932)
	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:93)
	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1404)
	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1389)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1384)
	at scala.tools.nsc.interpreter.IMain.compileSourcesKeepingRun(IMain.scala:430)
	at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compileAndSaveRun(IMain.scala:801)
	at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compile(IMain.scala:759)
	at scala.tools.nsc.interpreter.IMain$Request.compile$lzycompute(IMain.scala:948)
	at scala.tools.nsc.interpreter.IMain$Request.compile(IMain.scala:943)
	at scala.tools.nsc.interpreter.IMain.compile(IMain.scala:599)
	at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:588)
	at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:560)
	at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:825)
	at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:684)
	at scala.tools.nsc.interpreter.ILoop.processLine(ILoop.scala:402)
	at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:423)
	at scala.tools.nsc.interpreter.ILoop.$anonfun$process$1(ILoop.scala:993)
	at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:892)
	at scala.tools.nsc.interpreter.ILoop.main(ILoop.scala:1004)
	at xsbt.ConsoleInterface.run(ConsoleInterface.scala:62)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:101)
	at sbt.compiler.AnalyzingCompiler.console(AnalyzingCompiler.scala:76)
	at sbt.Console.sbt$Console$$console0$1(Console.scala:22)
	at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(Console.scala:23)
	at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply(Console.scala:23)
	at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply(Console.scala:23)
	at sbt.Logger$$anon$4.apply(Logger.scala:84)
	at sbt.TrapExit$App.run(TrapExit.scala:248)
	at java.lang.Thread.run(Thread.java:745)

That entry seems to have slain the compiler.  Shall I replay^Jyour session? I can re-run each line except the last one.^J[y/n]
@scabug
Copy link
Author

scabug commented Nov 10, 2016

Imported From: https://issues.scala-lang.org/browse/SI-10040?orig=1
Reporter: @Atry
Affected Versions: 2.11.8, 2.12.0

@SethTisue
Copy link
Member

2.12.18 crashes, 2.13.0 doesn't

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants