File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -303,6 +303,15 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
303303 // case x: Tree[?]
304304 // (which translates to)
305305 // case x: (_: Tree[?])
306+ case m @ MatchTypeTree (bounds, selector, cases) =>
307+ // Analog to the case above for match types
308+ def tranformIgnoringBoundsCheck (x : CaseDef ): CaseDef =
309+ super .transform(x)(ctx.addMode(Mode .Pattern )).asInstanceOf [CaseDef ]
310+ cpy.MatchTypeTree (tree)(
311+ super .transform(bounds),
312+ super .transform(selector),
313+ cases.mapConserve(tranformIgnoringBoundsCheck)
314+ )
306315 case tree =>
307316 super .transform(tree)
308317 }
Original file line number Diff line number Diff line change 1+ object Test {
2+ sealed trait Off
3+ case class Of [sup, sub <: sup]() extends Off
4+ type Sup [O <: Off ] = O match { case Of [sup, sub] => sup }
5+ type Sub [O <: Off ] = O match { case Of [sup, sub] => sub }
6+ type Copy [O <: Off ] = Of [Sup [O ], Sub [O ]]
7+ }
You can’t perform that action at this time.
0 commit comments