File tree 2 files changed +11
-1
lines changed
compiler/src/dotty/tools/dotc/typer
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1826,7 +1826,9 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
1826
1826
// check `pat` here and throw away the result.
1827
1827
val gadtCtx : Context = ctx.fresh.setFreshGADTBounds
1828
1828
val pat1 = typedPattern(pat, selType)(using gadtCtx)
1829
- val Typed (_, tpt) = tpd.unbind(tpd.unsplice(pat1)): @ unchecked
1829
+ val tpt = tpd.unbind(tpd.unsplice(pat1)) match
1830
+ case Typed (_, tpt) => tpt
1831
+ case UnApply (fun, _, p1 :: _) if fun.symbol == defn.TypeTest_unapply => p1
1830
1832
instantiateMatchTypeProto(pat1, pt) match {
1831
1833
case defn.MatchCase (patternTp, _) => tpt.tpe frozen_=:= patternTp
1832
1834
case _ => false
Original file line number Diff line number Diff line change
1
+
2
+ trait UsingTypeTest [B ](using reflect.TypeTest [Int , B ]):
3
+
4
+ type M [U <: Int ] = U match
5
+ case B => String
6
+
7
+ def m (t : Int ): M [Int ] = t match
8
+ case _ : B => " hello"
You can’t perform that action at this time.
0 commit comments