Skip to content

Completing in front of the opaque type definition will cause the REPL to crash #5895

Closed
@Glavo

Description

@Glavo

When I press the <TAB> key in front of opaque type, the REPL crashes:

scala> opaque type T = Int
Exception in thread "main" java.lang.AssertionError: assertion failed: position not set for T.T # 23565 of class dotty.tools.dotc.ast.Trees$Select in <typecheck>
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:19)
	at dotty.tools.dotc.typer.Typer$.assertPositioned(Typer.scala:60)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2064)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2080)
	at dotty.tools.dotc.typer.Namer.typedAheadType$$anonfun$1(Namer.scala:1092)
	at dotty.tools.dotc.typer.Namer.typedAheadImpl(Namer.scala:1085)
	at dotty.tools.dotc.typer.Namer.typedAheadType(Namer.scala:1092)
	at dotty.tools.dotc.typer.Namer.typeDefSig(Namer.scala:1360)
	at dotty.tools.dotc.typer.Namer$TypeDefCompleter.typeSig(Namer.scala:918)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:882)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:796)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:236)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:180)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:182)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:342)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:1932)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1957)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2033)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2068)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2066)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2080)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2141)
	at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:698)
	at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:701)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1987)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2034)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2068)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2080)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1095)
	at dotty.tools.dotc.typer.Namer.typedAheadImpl(Namer.scala:1085)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1095)
	at dotty.tools.dotc.typer.Namer.rhsType$2(Namer.scala:1218)
	at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1230)
	at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1231)
	at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1249)
	at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1257)
	at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:766)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:882)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:796)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:236)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:180)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:182)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:342)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:1932)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1957)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2033)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2068)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2080)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2141)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1674)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1970)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2033)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2068)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2080)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2141)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1795)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2012)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2034)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2068)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2080)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2152)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:61)
	at scala.compat.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:35)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:65)
	at dotty.tools.repl.REPLFrontEnd.runOn(ReplFrontEnd.scala:23)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:158)
	at scala.compat.java8.JProcedure1.apply(JProcedure1.java:18)
	at scala.compat.java8.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)
	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)
	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:198)
	at dotty.tools.dotc.Run.runPhases$5(Run.scala:170)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:178)
	at scala.compat.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:102)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:185)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:130)
	at dotty.tools.repl.ReplCompiler.typeCheck$$anonfun$1(ReplCompiler.scala:280)
	at scala.util.Either.flatMap(Either.scala:341)
	at dotty.tools.repl.ReplCompiler.typeCheck(ReplCompiler.scala:285)
	at dotty.tools.repl.ReplDriver.completions(ReplDriver.scala:166)
	at dotty.tools.repl.ReplDriver.$anonfun$1(ReplDriver.scala:110)
	at org.jline.reader.impl.LineReaderImpl.doComplete(LineReaderImpl.java:3962)
	at org.jline.reader.impl.LineReaderImpl.expandOrComplete(LineReaderImpl.java:3875)
	at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:585)
	at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:404)
	at dotty.tools.repl.JLineTerminal.readLine(JLineTerminal.scala:68)
	at dotty.tools.repl.ReplDriver.readLine$1(ReplDriver.scala:115)
	at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:125)
	at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:130)
	at dotty.tools.repl.ReplDriver.withRedirectedOutput$$anonfun$2$$anonfun$1(ReplDriver.scala:143)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
	at scala.Console$.withErr(Console.scala:196)
	at dotty.tools.repl.ReplDriver.withRedirectedOutput$$anonfun$1(ReplDriver.scala:143)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
	at scala.Console$.withOut(Console.scala:167)
	at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:143)
	at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:130)
	at dotty.tools.repl.Main$.main(Main.scala:6)
	at dotty.tools.repl.Main.main(Main.scala)

Trying to complete in front of other definitions won't crash the REPL.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions