Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1814,7 +1814,9 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
// check `pat` here and throw away the result.
val gadtCtx: Context = ctx.fresh.setFreshGADTBounds
val pat1 = typedPattern(pat, selType)(using gadtCtx)
val Typed(_, tpt) = tpd.unbind(tpd.unsplice(pat1)): @unchecked
val tpt = tpd.unbind(tpd.unsplice(pat1)) match
case Typed(_, tpt) => tpt
case UnApply(fun, _, p1 :: _) if fun.symbol == defn.TypeTest_unapply => p1
instantiateMatchTypeProto(pat1, pt) match {
case defn.MatchCase(patternTp, _) => tpt.tpe frozen_=:= patternTp
case _ => false
Expand Down
8 changes: 8 additions & 0 deletions tests/pos/i19692.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

trait UsingTypeTest[B](using reflect.TypeTest[Int, B]):

type M[U <: Int] = U match
case B => String

def m(t: Int): M[Int] = t match
case _: B => "hello"