@@ -175,6 +175,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
175175 * +- LambdaType -+- MethodOrPoly -+- MethodType
176176 * | | +- PolyType
177177 * | +- TypeLambda
178+ * +- MatchCase
178179 * +- TypeBounds
179180 * +- NoPrefix
180181 *
@@ -2678,6 +2679,40 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
26782679 end extension
26792680 end TypeLambdaMethods
26802681
2682+ /** Case of a `MatchType` containing pattern `case P => R`.
2683+ *
2684+ * Note: cases with type bindings are represented nested in a `TypeLambda`.
2685+ */
2686+ type MatchCase <: TypeRepr
2687+
2688+ /** `TypeTest` that allows testing at runtime in a pattern match if a `TypeRepr` is a `MatchCase` */
2689+ given MatchCaseTypeTest : TypeTest [TypeRepr , MatchCase ]
2690+
2691+ /** Module object of `type MatchCase` */
2692+ val MatchCase : MatchCaseModule
2693+
2694+ /** Methods of the module object `val MatchCase` */
2695+ trait MatchCaseModule { this : MatchCase .type =>
2696+ /* Create match type case `case <pattern> => <rhs>` */
2697+ def apply (pattern : TypeRepr , rhs : TypeRepr ): MatchCase
2698+ /* Matches a match type case `case <pattern> => <rhs>` */
2699+ def unapply (x : MatchCase ): (TypeRepr , TypeRepr )
2700+ }
2701+
2702+ /** Makes extension methods on `MatchCase` available without any imports */
2703+ given MatchCaseMethods : MatchCaseMethods
2704+
2705+ /** Extension methods of `MatchCase` */
2706+ trait MatchCaseMethods :
2707+ extension (self : MatchCase )
2708+ /** Pattern `P` of `case P => R` in a `MatchType` */
2709+ def pattern : TypeRepr
2710+ /** RHS `R` of `case P => R` in a `MatchType` */
2711+ def rhs : TypeRepr
2712+ end extension
2713+ end MatchCaseMethods
2714+
2715+
26812716 // ----- TypeBounds -----------------------------------------------
26822717
26832718 /** Type bounds */
0 commit comments