Closed
Description
minimized code
trait Foo[A]
class A {
def F[x : Foo]() = ???
Int match {
case Int | F => ()
}
}
Stack trace
-- [E135] Type Error: testing/Test.scala:6:19 ----------------------------------
6 | case Int | F => ()
| ^
| Stable identifier required, but this.F found
exception occurred while typechecking testing/Test.scala
exception occurred while compiling testing/Test.scala
java.lang.AssertionError: assertion failed: TermRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),module scala),module Int) ImplicitMethodType(List(evidence$1), List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class <empty>)),trait Foo),List(TypeVar(TypeParamRef(x))))), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing)) while compiling testing/Test.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: TermRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),module scala),module Int) ImplicitMethodType(List(evidence$1), List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class <empty>)),trait Foo),List(TypeVar(TypeParamRef(x))))), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing))
at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
at dotty.tools.dotc.core.Types$OrType.<init>(Types.scala:2878)
at dotty.tools.dotc.core.Types$CachedOrType.<init>(Types.scala:2932)
at dotty.tools.dotc.core.Types$OrType$.apply(Types.scala:2937)
at dotty.tools.dotc.core.TypeComparer.orType$$anonfun$1(TypeComparer.scala:1970)
at dotty.tools.dotc.core.TypeComparer.liftIfHK(TypeComparer.scala:1984)
at dotty.tools.dotc.core.TypeComparer.orType(TypeComparer.scala:1970)
at dotty.tools.dotc.core.TypeComparer.mergedLub$1(TypeComparer.scala:1787)
at dotty.tools.dotc.core.TypeComparer.lub(TypeComparer.scala:1789)
at dotty.tools.dotc.core.TypeComparer.lub$$anonfun$1(TypeComparer.scala:1795)
at scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:169)
at scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:165)
at scala.collection.immutable.List.foldLeft(List.scala:79)
at dotty.tools.dotc.core.TypeComparer.lub(TypeComparer.scala:1795)
at dotty.tools.dotc.typer.TypeAssigner.assignType(TypeAssigner.scala:602)
at dotty.tools.dotc.typer.Typer.assignType(Typer.scala:83)
at dotty.tools.dotc.typer.Typer.typedAlternative(Typer.scala:1550)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2149)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2177)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
at dotty.tools.dotc.typer.Typer.typedPattern(Typer.scala:2337)
at dotty.tools.dotc.typer.Typer.typedCase(Typer.scala:1217)
at dotty.tools.dotc.typer.Typer.typedCases$$anonfun$1(Typer.scala:1174)
at dotty.tools.dotc.core.Decorators$ListDecorator$.loop$1(Decorators.scala:63)
at dotty.tools.dotc.core.Decorators$ListDecorator$.mapconserve$extension(Decorators.scala:79)
at dotty.tools.dotc.typer.Typer.typedCases(Typer.scala:1176)
at dotty.tools.dotc.typer.Typer.$anonfun$18(Typer.scala:1166)
at dotty.tools.dotc.typer.Applications.harmonic(Applications.scala:1915)
at dotty.tools.dotc.typer.Typer.harmonic(Typer.scala:83)
at dotty.tools.dotc.typer.Typer.typedMatchFinish(Typer.scala:1166)
at dotty.tools.dotc.typer.Typer.typedMatch(Typer.scala:1148)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2132)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2177)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2269)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2291)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1784)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2109)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2176)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2247)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2291)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1910)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2150)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2177)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2333)
at dotty.tools.dotc.typer.FrontEnd.liftedTree1$2(FrontEnd.scala:78)
at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:83)
at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:42)
at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:84)
at dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$3(FrontEnd.scala:114)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:305)
at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:114)
at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:161)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
at dotty.tools.dotc.Run.runPhases$5(Run.scala:171)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:179)
at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:65)
at dotty.tools.dotc.Run.compileUnits(Run.scala:186)
at dotty.tools.dotc.Run.compileSources(Run.scala:123)
at dotty.tools.dotc.Run.compile(Run.scala:106)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:36)
at dotty.tools.dotc.Driver.process(Driver.scala:189)
at dotty.tools.dotc.Driver.process(Driver.scala:158)
at dotty.tools.dotc.Driver.process(Driver.scala:170)
at dotty.tools.dotc.Driver.main(Driver.scala:197)
at dotty.tools.dotc.Main.main(Main.scala)