@@ -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 *
@@ -2688,6 +2689,40 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
26882689 end extension
26892690 end TypeLambdaMethods
26902691
2692+ /** Case of a `MatchType` containing pattern `case P => R`.
2693+ *
2694+ * Note: cases with type bindings are represented nested in a `TypeLambda`.
2695+ */
2696+ type MatchCase <: TypeRepr
2697+
2698+ /** `TypeTest` that allows testing at runtime in a pattern match if a `TypeRepr` is a `MatchCase` */
2699+ given MatchCaseTypeTest : TypeTest [TypeRepr , MatchCase ]
2700+
2701+ /** Module object of `type MatchCase` */
2702+ val MatchCase : MatchCaseModule
2703+
2704+ /** Methods of the module object `val MatchCase` */
2705+ trait MatchCaseModule { this : MatchCase .type =>
2706+ /* Create match type case `case <pattern> => <rhs>` */
2707+ def apply (pattern : TypeRepr , rhs : TypeRepr ): MatchCase
2708+ /* Matches a match type case `case <pattern> => <rhs>` */
2709+ def unapply (x : MatchCase ): (TypeRepr , TypeRepr )
2710+ }
2711+
2712+ /** Makes extension methods on `MatchCase` available without any imports */
2713+ given MatchCaseMethods : MatchCaseMethods
2714+
2715+ /** Extension methods of `MatchCase` */
2716+ trait MatchCaseMethods :
2717+ extension (self : MatchCase )
2718+ /** Pattern `P` of `case P => R` in a `MatchType` */
2719+ def pattern : TypeRepr
2720+ /** RHS `R` of `case P => R` in a `MatchType` */
2721+ def rhs : TypeRepr
2722+ end extension
2723+ end MatchCaseMethods
2724+
2725+
26912726 // ----- TypeBounds -----------------------------------------------
26922727
26932728 /** Type bounds */
0 commit comments