Skip to content

The unexpected assertion failed when using the type field syntax to represent the generic type #2492

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

Closed
Glavo opened this issue May 21, 2017 · 6 comments

Comments

@Glavo
Copy link
Contributor

Glavo commented May 21, 2017

When I try this code in dotty repl, repl accidentally generates an assertion failure and crashes

scala> class Map[K, V] 
defined class Map
scala> val s: Map {type Map$K =String;type Map$V = int} = null[error] (run-main-0) java.lang.AssertionError: assertion failed: [=line16$object$$iw$$iw$Map$$K, =line16$object$$iw$$iw$Map$$V] => Map[=K, =V] & <refinement> / HKTypeLambda(List(=line16$object$$iw$$iw$Map$$K, =line16$object$$iw$$iw$Map$$V), List(TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,scala)),Nothing), TypeRef(ThisType(TypeRef(NoPrefix,scala)),Any)), TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,scala)),Nothing), TypeRef(ThisType(TypeRef(NoPrefix,scala)),Any))), RefinedType(RefinedType(TypeRef(TermRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix,<empty>)),line16$object)/withSig(Signature(List(),)),$iw)/withSig(Signature(List(),)),$iw)/withSig(Signature(List(),)),Map), line16$object$$iw$$iw$Map$$K, TypeAlias(ParamRef(=line16$object$$iw$$iw$Map$$K), 0)), line16$object$$iw$$iw$Map$$V, TypeAlias(ParamRef(=line16$object$$iw$$iw$Map$$V), 0))) & TypeRef(NoPrefix,<refinement>)

java.lang.AssertionError: assertion failed: [=line16$object$$iw$$iw$Map$$K, =line16$object$$iw$$iw$Map$$V] => Map[=K, =V] & <refinement> / HKTypeLambda(List(=line16$object$$iw$$iw$Map$$K, =line16$object$$iw$$iw$Map$$V), List(TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,scala)),Nothing), TypeRef(ThisType(TypeRef(NoPrefix,scala)),Any)), TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,scala)),Nothing), TypeRef(ThisType(TypeRef(NoPrefix,scala)),Any))), RefinedType(RefinedType(TypeRef(TermRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix,<empty>)),line16$object)/withSig(Signature(List(),)),$iw)/withSig(Signature(List(),)),$iw)/withSig(Signature(List(),)),Map), line16$object$$iw$$iw$Map$$K, TypeAlias(ParamRef(=line16$object$$iw$$iw$Map$$K), 0)), line16$object$$iw$$iw$Map$$V, TypeAlias(ParamRef(=line16$object$$iw$$iw$Map$$V), 0))) & TypeRef(NoPrefix,<refinement>)
	at scala.Predef$.assert(Predef.scala:170)
	at dotty.tools.dotc.core.Types$AndType$.apply(Types.scala:2267)
	at dotty.tools.dotc.core.Types$ClassInfo.selfType(Types.scala:3174)
	at dotty.tools.dotc.core.Types$ThisType.underlying(Types.scala:2029)
	at dotty.tools.dotc.core.Types$Type.goThis$1(Types.scala:553)
	at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:441)
	at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:592)
	at dotty.tools.dotc.core.Types$Type.memberExcluding(Types.scala:428)
	at dotty.tools.dotc.core.Types$Type.op$22(Types.scala:412)
	at dotty.tools.dotc.core.Types$Type.member(Types.scala:411)
	at dotty.tools.dotc.typer.NamerContextOps.denotNamed(Namer.scala:52)
	at dotty.tools.dotc.typer.Typer.loop$18(Typer.scala:263)
	at dotty.tools.dotc.typer.Typer.findRef$1(Typer.scala:314)
	at dotty.tools.dotc.typer.Typer.op$84(Typer.scala:333)
	at dotty.tools.dotc.typer.Typer.typedIdent(Typer.scala:98)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1511)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1576)
	at dotty.tools.dotc.typer.Typer.op$87(Typer.scala:1595)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1593)
	at dotty.tools.dotc.typer.Namer.typedAheadType$$anonfun$1(Namer.scala:931)
	at dotty.tools.dotc.typer.Namer.typedAheadImpl(Namer.scala:924)
	at dotty.tools.dotc.typer.Namer.typedAheadType(Namer.scala:931)
	at dotty.tools.dotc.typer.Namer.typeDefSig(Namer.scala:1168)
	at dotty.tools.dotc.typer.Namer$TypeDefCompleter.typeSig(Namer.scala:806)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:777)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:755)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:226)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.info(SymDenotations.scala:204)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:343)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:1484)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1509)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1576)
	at dotty.tools.dotc.typer.Typer.op$87(Typer.scala:1595)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1593)
	at dotty.tools.dotc.typer.Typer.traverse$5(Typer.scala:1617)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1637)
	at dotty.tools.dotc.typer.Typer.op$97(Typer.scala:1328)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1276)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1522)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1576)
	at dotty.tools.dotc.typer.Typer.op$87(Typer.scala:1595)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1593)
	at dotty.tools.dotc.typer.Typer.op$93(Typer.scala:1051)
	at dotty.tools.dotc.typer.Typer.typedRefinedTypeTree(Typer.scala:1047)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1555)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1577)
	at dotty.tools.dotc.typer.Typer.op$87(Typer.scala:1595)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1593)
	at dotty.tools.dotc.typer.Namer.typedAheadType$$anonfun$1(Namer.scala:931)
	at dotty.tools.dotc.typer.Namer.typedAheadImpl(Namer.scala:924)
	at dotty.tools.dotc.typer.Namer.typedAheadType(Namer.scala:931)
	at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1096)
	at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:729)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:777)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:755)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:226)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.info(SymDenotations.scala:204)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:343)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:1484)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1509)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1576)
	at dotty.tools.dotc.typer.Typer.op$87(Typer.scala:1595)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1593)
	at dotty.tools.dotc.typer.Typer.traverse$5(Typer.scala:1617)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1637)
	at dotty.tools.dotc.typer.Typer.op$97(Typer.scala:1328)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1276)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1522)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1576)
	at dotty.tools.dotc.typer.Typer.op$87(Typer.scala:1595)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1593)
	at dotty.tools.dotc.typer.Typer.traverse$5(Typer.scala:1617)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1637)
	at dotty.tools.dotc.typer.Typer.op$97(Typer.scala:1328)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1276)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1522)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1576)
	at dotty.tools.dotc.typer.Typer.op$87(Typer.scala:1595)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1593)
	at dotty.tools.dotc.typer.Typer.traverse$5(Typer.scala:1617)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1637)
	at dotty.tools.dotc.typer.Typer.op$97(Typer.scala:1328)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1276)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1522)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1576)
	at dotty.tools.dotc.typer.Typer.op$87(Typer.scala:1595)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1593)
	at dotty.tools.dotc.typer.Typer.traverse$5(Typer.scala:1617)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1637)
	at dotty.tools.dotc.typer.Typer.op$94(Typer.scala:1437)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1424)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1561)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1577)
	at dotty.tools.dotc.typer.Typer.op$87(Typer.scala:1595)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1593)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1649)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:64)
	at scala.compat.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:32)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:68)
	at dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$7(FrontEnd.scala:93)
	at scala.compat.java8.JProcedure1.apply(JProcedure1.java:18)
	at scala.compat.java8.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:392)
	at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:93)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$1(Run.scala:82)
	at scala.compat.java8.JProcedure1.apply(JProcedure1.java:18)
	at scala.compat.java8.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:90)
	at scala.compat.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.monitorHeartBeat(Stats.scala:76)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:95)
	at dotty.tools.dotc.Run.compileSources(Run.scala:64)
	at dotty.tools.dotc.repl.CompilingInterpreter.compileSources(CompilingInterpreter.scala:195)
	at dotty.tools.dotc.repl.CompilingInterpreter$Request.compile(CompilingInterpreter.scala:405)
	at dotty.tools.dotc.repl.CompilingInterpreter.interpret(CompilingInterpreter.scala:220)
	at dotty.tools.dotc.repl.AmmoniteReader.incompleteInput$$anonfun$1(AmmoniteReader.scala:19)
	at dotty.tools.dotc.repl.CompilingInterpreter.delayOutputDuring(CompilingInterpreter.scala:103)
	at dotty.tools.dotc.repl.AmmoniteReader.incompleteInput(AmmoniteReader.scala:19)
	at dotty.tools.dotc.repl.AmmoniteReader.dotty$tools$dotc$repl$AmmoniteReader$multilineFilter$$isDefinedAt$13(AmmoniteReader.scala:31)
	at dotty.tools.dotc.repl.AmmoniteReader$$anonfun$468.isDefinedAt(AmmoniteReader.scala:32)
	at dotty.tools.dotc.repl.AmmoniteReader$$anonfun$468.isDefinedAt(AmmoniteReader.scala:32)
	at scala.PartialFunction$class.applyOrElse(PartialFunction.scala:123)
	at dotty.tools.dotc.repl.AmmoniteReader$$anonfun$468.applyOrElse(AmmoniteReader.scala:30)
	at dotty.tools.dotc.repl.AmmoniteReader$$anonfun$468.applyOrElse(AmmoniteReader.scala:32)
	at scala.PartialFunction$Lifted.apply(PartialFunction.scala:223)
	at scala.PartialFunction$Lifted.apply(PartialFunction.scala:219)
	at dotty.tools.dotc.repl.ammonite.terminal.Filter$$anon$72.$init$$$anonfun$66$$anonfun$1(Filter.scala:21)
	at scala.collection.Iterator$$anon$11.next(Iterator.scala:410)
	at scala.collection.Iterator$class.find(Iterator.scala:942)
	at scala.collection.AbstractIterator.find(Iterator.scala:1334)
	at dotty.tools.dotc.repl.ammonite.terminal.Filter$$anon$72.$init$$$anonfun$66(Filter.scala:21)
	at dotty.tools.dotc.repl.ammonite.terminal.Terminal$.readChar$1(Terminal.scala:267)
	at dotty.tools.dotc.repl.ammonite.terminal.Terminal$.readLine(Terminal.scala:299)
	at dotty.tools.dotc.repl.AmmoniteReader.readLine(AmmoniteReader.scala:74)
	at dotty.tools.dotc.repl.InterpreterLoop.repl$default$1(InterpreterLoop.scala:75)
	at dotty.tools.dotc.repl.InterpreterLoop.repl(InterpreterLoop.scala:77)
	at dotty.tools.dotc.repl.InterpreterLoop.run(InterpreterLoop.scala:202)
	at dotty.tools.dotc.repl.REPL.doCompile(REPL.scala:43)
	at dotty.tools.dotc.Driver.process(Driver.scala:124)
	at dotty.tools.dotc.Driver.process(Driver.scala:93)
	at dotty.tools.dotc.Driver.process(Driver.scala:105)
	at xsbt.ConsoleInterface.run(ConsoleInterface.scala:42)
	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:107)
	at sbt.compiler.AnalyzingCompiler.console(AnalyzingCompiler.scala:82)
	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:748)
java.lang.RuntimeException: Nonzero exit code: 1
	at scala.sys.package$.error(package.scala:27)
	at sbt.Defaults$$anonfun$consoleTask$1$$anonfun$apply$54.apply(Defaults.scala:850)
	at sbt.Defaults$$anonfun$consoleTask$1$$anonfun$apply$54.apply(Defaults.scala:850)
	at scala.Option.foreach(Option.scala:236)
	at sbt.Defaults$$anonfun$consoleTask$1.apply(Defaults.scala:850)
	at sbt.Defaults$$anonfun$consoleTask$1.apply(Defaults.scala:845)
	at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:35)
	at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:34)
	at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
	at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
	at sbt.std.Transform$$anon$4.work(System.scala:63)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
	at sbt.Execute.work(Execute.scala:237)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
	at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
	at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)

What is the cause of this behavior?

@nicolasstucki
Copy link
Contributor

@odersky should have a look at this one. It looks like a general issue when refining type parameters using type members.

Here is a smaller example that fails in a similar way

class Map[K]
object Foo {
  type X = Map { type Map$$K = String }
}

It crashes with

-- [E055] Syntax Error: foo.scala:4:11 -----------------------------------------
4 |  type X = Map { type Map$$K = String }
  |           ^^^
  |           missing type parameter for [Map$$K] => Map[K]

exception occurred while typechecking foo.scala

exception occurred while compiling foo.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: [Map$$K] => Map[K] & <refinement> / HKTypeLambda(List(Map$$K), List(TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,scala)),Nothing), TypeRef(ThisType(TypeRef(NoPrefix,scala)),Any))), RefinedType(TypeRef(ThisType(TypeRef(NoPrefix,<empty>)),Map), Map$$K, TypeAlias(ParamRef(Map$$K), 0))) & TypeRef(NoPrefix,<refinement>)
	at scala.Predef$.assert(Predef.scala:170)
	at dotty.tools.dotc.core.Types$AndType$.apply(Types.scala:2314)
	at dotty.tools.dotc.core.Types$ClassInfo.selfType(Types.scala:3221)
	at dotty.tools.dotc.core.Types$ThisType.underlying(Types.scala:2076)
	at dotty.tools.dotc.core.Types$Type.goThis$1(Types.scala:590)
	at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:478)
	at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:629)
	at dotty.tools.dotc.core.Types$Type.memberExcluding(Types.scala:465)
	at dotty.tools.dotc.core.Types$Type$$anonfun$member$1.apply(Types.scala:449)
	at dotty.tools.dotc.core.Types$Type$$anonfun$member$1.apply(Types.scala:449)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.core.Types$Type.member(Types.scala:448)
	at dotty.tools.dotc.typer.NamerContextOps$class.denotNamed(Namer.scala:52)
	at dotty.tools.dotc.core.Contexts$Context.denotNamed(Contexts.scala:57)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedIdent$1.loop$1(Typer.scala:249)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedIdent$1.findRef$1(Typer.scala:300)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedIdent$1.apply(Typer.scala:319)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedIdent$1.apply(Typer.scala:98)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedIdent(Typer.scala:98)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1506)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1571)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1587)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1585)
	at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:140)
	at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1585)
	at dotty.tools.dotc.typer.Namer$$anonfun$typedAheadType$1.apply(Namer.scala:931)
	at dotty.tools.dotc.typer.Namer$$anonfun$typedAheadType$1.apply(Namer.scala:931)
	at dotty.tools.dotc.typer.Namer.typedAheadImpl(Namer.scala:924)
	at dotty.tools.dotc.typer.Namer.typedAheadType(Namer.scala:931)
	at dotty.tools.dotc.typer.Namer.typeDefSig(Namer.scala:1168)
	at dotty.tools.dotc.typer.Namer$TypeDefCompleter.typeSig(Namer.scala:806)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:777)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:755)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:219)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.info(SymDenotations.scala:197)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:336)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:1479)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1504)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1571)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1587)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1585)
	at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:140)
	at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1585)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1609)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1629)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1319)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1267)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1267)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1517)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1571)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1587)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1585)
	at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:140)
	at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1585)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedRefinedTypeTree$1.apply(Typer.scala:1038)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedRefinedTypeTree$1.apply(Typer.scala:1034)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedRefinedTypeTree(Typer.scala:1034)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1550)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1572)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1587)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1585)
	at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:140)
	at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1585)
	at dotty.tools.dotc.typer.Namer$$anonfun$typedAheadType$1.apply(Namer.scala:931)
	at dotty.tools.dotc.typer.Namer$$anonfun$typedAheadType$1.apply(Namer.scala:931)
	at dotty.tools.dotc.typer.Namer.typedAheadImpl(Namer.scala:924)
	at dotty.tools.dotc.typer.Namer.typedAheadType(Namer.scala:931)
	at dotty.tools.dotc.typer.Namer.typeDefSig(Namer.scala:1168)
	at dotty.tools.dotc.typer.Namer$TypeDefCompleter.typeSig(Namer.scala:806)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:777)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:755)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:219)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.info(SymDenotations.scala:197)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:336)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:1479)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1504)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1571)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1587)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1585)
	at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:140)
	at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1585)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1609)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1629)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1319)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1267)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1267)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1517)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1571)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1587)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1585)
	at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:140)
	at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1585)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1609)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1629)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:1432)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:1419)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1419)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1556)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1572)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1587)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1585)
	at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:140)
	at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1585)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1641)
	at dotty.tools.dotc.typer.FrontEnd$$anonfun$typeCheck$1.apply$mcV$sp(FrontEnd.scala:64)
	at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:32)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:62)
	at dotty.tools.dotc.typer.FrontEnd$$anonfun$runOn$3.apply(FrontEnd.scala:93)
	at dotty.tools.dotc.typer.FrontEnd$$anonfun$runOn$3.apply(FrontEnd.scala:93)
	at scala.collection.immutable.List.foreach(List.scala:392)
	at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:93)
	at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:82)
	at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:79)
	at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
	at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply$mcV$sp(Run.scala:79)
	at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:67)
	at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:67)
	at dotty.tools.dotc.util.Stats$.monitorHeartBeat(Stats.scala:76)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:67)
	at dotty.tools.dotc.Run.compileSources(Run.scala:64)
	at dotty.tools.dotc.Run.compile(Run.scala:48)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:26)
	at dotty.tools.dotc.Driver.process(Driver.scala:124)
	at dotty.tools.dotc.Driver.process(Driver.scala:93)
	at dotty.tools.dotc.Driver.process(Driver.scala:105)
	at dotty.tools.dotc.Driver.main(Driver.scala:132)
	at dotty.tools.dotc.Main.main(Main.scala)

@odersky
Copy link
Contributor

odersky commented May 26, 2017

You can't refine the types like this. Generally, all symbols containing $'s are reserved. If you use them anything could happen. We don't forbid using them because sometimes it is useful or even essential to access these symbols but you really need to know what you are doing. In this case there's an internal requirements that any refinements of these names have some internal flags set (Param, BaseTypeArg) but these flags are inaccessible to user programs. So long story short: You can'd do this.

@odersky odersky closed this as completed May 26, 2017
@nicolasstucki
Copy link
Contributor

I guess this code came from http://dotty.epfl.ch/docs/internals/higher-kinded-v2.html#the-duality which is misleading. We might want to rephrase that document to not look like valid scala code.

@nicolasstucki
Copy link
Contributor

@odersky, I would imagine given that the compiler has already found an error it could stop there and not crash later.

@nicolasstucki nicolasstucki reopened this May 26, 2017
@odersky
Copy link
Contributor

odersky commented May 26, 2017

Good suggestion about changing the docs.

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue May 26, 2017
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue May 26, 2017
@nicolasstucki
Copy link
Contributor

I created #2548 to address the issue with the docs.

nicolasstucki added a commit that referenced this issue May 28, 2017
Fix #2492: Avoid typing the body when self has error type
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