diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 9b7e4fe36668..9c3750c68621 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -2665,7 +2665,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer val lub = cases1.foldLeft(defn.NothingType: Type): (acc, case1) => if !acc.exists then NoType else if case1.body.tpe.isProvisional then NoType - else acc | TypeOps.avoid(case1.body.tpe, case1.pat.bindTypeSymbols) + else acc | case1.body.tpe if lub.exists then if !lub.isAny then val msg = em"Match type upper bound inferred as $lub, where previously it was defaulted to Any" diff --git a/tests/pos/i21256.scala b/tests/pos/i21256.scala deleted file mode 100644 index e51484c73ef7..000000000000 --- a/tests/pos/i21256.scala +++ /dev/null @@ -1,5 +0,0 @@ -object Test { - type MTWithBind[X] = X match { - case List[t] => t - } -}