File tree 2 files changed +16
-0
lines changed
compiler/src/dotty/tools/dotc/transform
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
303
303
// case x: Tree[?]
304
304
// (which translates to)
305
305
// 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
+ )
306
315
case tree =>
307
316
super .transform(tree)
308
317
}
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