Closed
Description
Compiler version
3.1.2-RC1-bin-20220121-7ce60e1-NIGHTLY
3.1.0
3.0.1
Minimized code
trait Module:
self =>
type M <: Module {
type X = self.X
type Y = self.Y
}
type X
type Y
def expose: Expose[X, Y, M]
trait Expose[
X0,
Y0,
M <: Module { type X = X0; type Y = Y0 }
]
def test(ms: Seq[Option[Module]]): Seq[Expose[_, _, _]] =
ms.collect { case Some(module) => module.expose }
Output (click arrow to expand)
[error] java.lang.AssertionError: assertion failed: leak: (module : Module) in {
[error] module.expose:Expose[?, ?, ? <: Module{X = module.X}]
[error] }
[error] at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
[error] at dotty.tools.dotc.typer.Typer.ensureNoLocalRefs(Typer.scala:1122)
[error] at dotty.tools.dotc.typer.Typer.caseRest$1(Typer.scala:1677)
[error] at dotty.tools.dotc.typer.Typer.typedCase(Typer.scala:1693)
[error] at dotty.tools.dotc.typer.Typer.typedCases$$anonfun$1(Typer.scala:1623)
[error] at dotty.tools.dotc.core.Decorators$ListDecorator$.loop$1(Decorators.scala:92)
[error] at dotty.tools.dotc.core.Decorators$ListDecorator$.mapconserve$extension(Decorators.scala:108)
[error] at dotty.tools.dotc.typer.Typer.typedCases(Typer.scala:1625)
[error] at dotty.tools.dotc.typer.Typer.$anonfun$26(Typer.scala:1615)
[error] at dotty.tools.dotc.typer.Applications.harmonic(Applications.scala:2181)
[error] at dotty.tools.dotc.typer.Applications.harmonic$(Applications.scala:317)
[error] at dotty.tools.dotc.typer.Typer.harmonic(Typer.scala:119)
[error] at dotty.tools.dotc.typer.Typer.typedMatchFinish(Typer.scala:1615)
[error] at dotty.tools.dotc.typer.Typer.typedMatch(Typer.scala:1571)
[error] at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2816)
[error] at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865)
[error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930)
[error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934)
[error] at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3050)
[error] at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1473)
[error] at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1463)
[error] at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1473)
[error] at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1530)
[error] at dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1588)
[error] at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:782)
[error] at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:914)
[error] at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:806)
[error] at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:168)
[error] at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:188)
[error] at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:190)
[error] at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:370)
[error] at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2744)
[error] at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2769)
[error] at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2864)
[error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930)
[error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934)
[error] at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2956)
[error] at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3006)
[error] at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1067)
[error] at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1071)
[error] at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2810)
[error] at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865)
[error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930)
[error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934)
[error] at dotty.tools.dotc.typer.Typer.typedFunctionValue(Typer.scala:1450)
[error] at dotty.tools.dotc.typer.Typer.typedFunction(Typer.scala:1239)
[error] at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2812)
[error] at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865)
[error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930)
[error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934)
[error] at dotty.tools.dotc.typer.Typer.typedMatch(Typer.scala:1517)
[error] at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2816)
[error] at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865)
[error] at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$7(ProtoTypes.scala:431)
[error] at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:359)
[error] at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:432)
[error] at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:853)
[error] at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:853)
[error] at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:544)
[error] at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:609)
[error] at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:447)
[error] at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:735)
[error] at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:852)
[error] at dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1051)
[error] at dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:317)
[error] at dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:119)
[error] at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:898)
[error] at dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$3(Applications.scala:977)
[error] at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3074)
[error] at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:988)
[error] at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1026)
[error] at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:317)
[error] at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:119)
[error] at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2802)
[error] at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865)
[error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930)
[error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934)
[error] at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3050)
[error] at dotty.tools.dotc.typer.Typer.$anonfun$47(Typer.scala:2249)
[error] at dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:238)
[error] at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2249)
[error] at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2779)
[error] at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2864)
[error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930)
[error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934)
[error] at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2956)
[error] at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3006)
[error] at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2447)
[error] at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:2790)
[error] at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2794)
[error] at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2864)
[error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930)
[error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934)
[error] at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2956)
[error] at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3006)
[error] at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2574)
[error] at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2835)
[error] at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2865)
[error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2930)
[error] at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2934)
[error] at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3050)
[error] at dotty.tools.dotc.typer.TyperPhase.liftedTree1$1(TyperPhase.scala:47)
[error] at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:53)
[error] at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:411)
[error] at dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:54)
[error] at dotty.tools.dotc.typer.TyperPhase.runOn$$anonfun$3(TyperPhase.scala:88)
[error] at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] at scala.collection.immutable.List.foreach(List.scala:333)
[error] at dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:88)
[error] at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:259)
[error] at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1328)
[error] at dotty.tools.dotc.Run.runPhases$1(Run.scala:270)
[error] at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:278)
[error] at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
[error] at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
[error] at dotty.tools.dotc.Run.compileUnits(Run.scala:287)
[error] at dotty.tools.dotc.Run.compileUnits(Run.scala:226)
[error] at dotty.tools.repl.ReplCompiler.runCompilationUnit(ReplCompiler.scala:167)
[error] at dotty.tools.repl.ReplCompiler.compile(ReplCompiler.scala:178)
[error] at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:259)
[error] at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:227)
[error] at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:161)
[error] at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:164)
[error] at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:183)
[error] at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:164)
[error] at xsbt.ConsoleInterface.run(ConsoleInterface.java:52)
[error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[error] at sbt.internal.inc.AnalyzingCompiler.invoke(AnalyzingCompiler.scala:329)
[error] at sbt.internal.inc.AnalyzingCompiler.console(AnalyzingCompiler.scala:233)
[error] at sbt.Console.console0$1(Console.scala:64)
[error] at sbt.Console.$anonfun$apply$5(Console.scala:74)
[error] at sbt.Run$.executeSuccess(Run.scala:186)
[error] at sbt.Console.$anonfun$apply$4(Console.scala:74)
[error] at sbt.internal.util.Terminal.withRawInput(Terminal.scala:145)
[error] at sbt.internal.util.Terminal.withRawInput$(Terminal.scala:143)
[error] at sbt.internal.util.Terminal$ProxyTerminal$.withRawInput(Terminal.scala:384)
[error] at sbt.Console.$anonfun$apply$3(Console.scala:74)
[error] at sbt.internal.util.Terminal$TerminalImpl.withRawOutput(Terminal.scala:975)
[error] at sbt.internal.util.Terminal$ProxyTerminal$.withRawOutput(Terminal.scala:423)
[error] at sbt.Console.apply(Console.scala:71)
[error] at sbt.Console.apply(Console.scala:49)
[error] at sbt.Console.apply(Console.scala:41)
[error] at sbt.Defaults$.$anonfun$consoleTask$1(Defaults.scala:2232)
[error] at sbt.Defaults$.$anonfun$consoleTask$1$adapted(Defaults.scala:2218)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] at sbt.Execute.work(Execute.scala:291)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error] at java.base/java.lang.Thread.run(Thread.java:829)