diff --git a/compiler/src/dotty/tools/dotc/transform/PostTyper.scala b/compiler/src/dotty/tools/dotc/transform/PostTyper.scala index 29baf816da5e..5db88a3787cb 100644 --- a/compiler/src/dotty/tools/dotc/transform/PostTyper.scala +++ b/compiler/src/dotty/tools/dotc/transform/PostTyper.scala @@ -667,15 +667,6 @@ class PostTyper extends MacroTransform with InfoTransformer { thisPhase => // case x: Tree[?] // (which translates to) // case x: (_: Tree[?]) - case m @ MatchTypeTree(bounds, selector, cases) => - // Analog to the case above for match types - def transformIgnoringBoundsCheck(x: CaseDef): CaseDef = - withMode(Mode.Pattern)(super.transform(x)).asInstanceOf[CaseDef] - cpy.MatchTypeTree(tree)( - super.transform(bounds), - super.transform(selector), - cases.mapConserve(transformIgnoringBoundsCheck) - ) case Block(_, Closure(_, _, tpt)) if ExpandSAMs.needsWrapperClass(tpt.tpe) => superAcc.withInvalidCurrentClass(super.transform(tree)) case tree: RefinedTypeTree => diff --git a/tests/neg/i24313.check b/tests/neg/i24313.check new file mode 100644 index 000000000000..e987d4ea9376 --- /dev/null +++ b/tests/neg/i24313.check @@ -0,0 +1,6 @@ +-- [E057] Type Mismatch Error: tests/neg/i24313.scala:4:14 ------------------------------------------------------------- +4 | case _ => S[String] // error + | ^ + | Type argument String does not conform to upper bound Int + | + | longer explanation available when compiling with `-explain` diff --git a/tests/neg/i24313.scala b/tests/neg/i24313.scala new file mode 100644 index 000000000000..d4b730e2ea90 --- /dev/null +++ b/tests/neg/i24313.scala @@ -0,0 +1,4 @@ +type S[N <: Int] + +type Foo[Xs] = Xs match + case _ => S[String] // error