@@ -142,24 +142,24 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
142142 * +- Alternatives
143143 *
144144 *
145- * +- TypeRepr -+- ConstantType
146- * +- TermRef
147- * +- TypeRef
145+ * +- TypeRepr -+- NamedType -+- TermRef
146+ * | +- TypeRef
147+ * +- ConstantType
148148 * +- SuperType
149149 * +- Refinement
150150 * +- AppliedType
151151 * +- AnnotatedType
152- * +- AndType
153- * +- OrType
152+ * +- AndOrType -+- AndType
153+ * | +- OrType
154154 * +- MatchType
155155 * +- ByNameType
156156 * +- ParamRef
157157 * +- ThisType
158158 * +- RecursiveThis
159159 * +- RecursiveType
160- * +- MethodType
161- * +- PolyType
162- * +- TypeLambda
160+ * +- LambdaType -+- MethodOrPoly -+- MethodType
161+ * | | +- PolyType
162+ * | +- TypeLambda
163163 * +- TypeBounds
164164 * +- NoPrefix
165165 *
@@ -172,6 +172,8 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
172172 *
173173 * +- Position
174174 *
175+ * +- SourceFile
176+ *
175177 * +- Documentation
176178 *
177179 * +- Constant
@@ -2203,8 +2205,25 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
22032205 end extension
22042206 end ConstantTypeMethods
22052207
2208+ /** Type of a reference to a type or term symbol */
2209+ type NamedType <: TypeRepr
2210+
2211+ /** `TypeTest` that allows testing at runtime in a pattern match if a `TypeRepr` is a `NamedType` */
2212+ given NamedTypeTypeTest : TypeTest [TypeRepr , NamedType ]
2213+
2214+ /** Makes extension methods on `NamedType` available without any imports */
2215+ given NamedTypeMethods : NamedTypeMethods
2216+
2217+ /** Extension methods of `NamedType` */
2218+ trait NamedTypeMethods :
2219+ extension (self : NamedType ):
2220+ def qualifier : TypeRepr
2221+ def name : String
2222+ end extension
2223+ end NamedTypeMethods
2224+
22062225 /** Type of a reference to a term symbol */
2207- type TermRef <: TypeRepr
2226+ type TermRef <: NamedType
22082227
22092228 /** `TypeTest` that allows testing at runtime in a pattern match if a `TypeRepr` is a `TermRef` */
22102229 given TermRefTypeTest : TypeTest [TypeRepr , TermRef ]
@@ -2218,19 +2237,8 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
22182237 def unapply (x : TermRef ): Option [(TypeRepr , String )]
22192238 }
22202239
2221- /** Makes extension methods on `TermRef` available without any imports */
2222- given TermRefMethods : TermRefMethods
2223-
2224- /** Extension methods of `TermRef` */
2225- trait TermRefMethods :
2226- extension (self : TermRef ):
2227- def qualifier : TypeRepr
2228- def name : String
2229- end extension
2230- end TermRefMethods
2231-
22322240 /** Type of a reference to a type symbol */
2233- type TypeRef <: TypeRepr
2241+ type TypeRef <: NamedType
22342242
22352243 /** `TypeTest` that allows testing at runtime in a pattern match if a `TypeRepr` is a `TypeRef` */
22362244 given TypeRefTypeTest : TypeTest [TypeRepr , TypeRef ]
@@ -2249,8 +2257,6 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
22492257 /** Extension methods of `TypeRef` */
22502258 trait TypeRefMethods :
22512259 extension (self : TypeRef ):
2252- def qualifier : TypeRepr
2253- def name : String
22542260 def isOpaqueAlias : Boolean
22552261 def translucentSuperType : TypeRepr
22562262 end extension
@@ -2360,8 +2366,26 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
23602366 end extension
23612367 end AnnotatedTypeMethods
23622368
2369+
2370+ /** Intersection type `T & U` or an union type `T | U` */
2371+ type AndOrType <: TypeRepr
2372+
2373+ /** `TypeTest` that allows testing at runtime in a pattern match if a `TypeRepr` is an `AndOrType` */
2374+ given AndOrTypeTypeTest : TypeTest [TypeRepr , AndOrType ]
2375+
2376+ /** Makes extension methods on `AndOrType` available without any imports */
2377+ given AndOrTypeMethods : AndOrTypeMethods
2378+
2379+ /** Extension methods of `AndOrType` */
2380+ trait AndOrTypeMethods :
2381+ extension (self : AndOrType ):
2382+ def left : TypeRepr
2383+ def right : TypeRepr
2384+ end extension
2385+ end AndOrTypeMethods
2386+
23632387 /** Intersection type `T & U` */
2364- type AndType <: TypeRepr
2388+ type AndType <: AndOrType
23652389
23662390 /** `TypeTest` that allows testing at runtime in a pattern match if a `TypeRepr` is an `AndType` */
23672391 given AndTypeTypeTest : TypeTest [TypeRepr , AndType ]
@@ -2375,19 +2399,8 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
23752399 def unapply (x : AndType ): Option [(TypeRepr , TypeRepr )]
23762400 }
23772401
2378- /** Makes extension methods on `AndType` available without any imports */
2379- given AndTypeMethods : AndTypeMethods
2380-
2381- /** Extension methods of `AndType` */
2382- trait AndTypeMethods :
2383- extension (self : AndType ):
2384- def left : TypeRepr
2385- def right : TypeRepr
2386- end extension
2387- end AndTypeMethods
2388-
23892402 /** Union type `T | U` */
2390- type OrType <: TypeRepr
2403+ type OrType <: AndOrType
23912404
23922405 /** `TypeTest` that allows testing at runtime in a pattern match if a `TypeRepr` is an `OrType` */
23932406 given OrTypeTypeTest : TypeTest [TypeRepr , OrType ]
@@ -2401,17 +2414,6 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
24012414 def unapply (x : OrType ): Option [(TypeRepr , TypeRepr )]
24022415 }
24032416
2404- /** Makes extension methods on `OrType` available without any imports */
2405- given OrTypeMethods : OrTypeMethods
2406-
2407- /** Extension methods of `OrType` */
2408- trait OrTypeMethods :
2409- extension (self : OrType ):
2410- def left : TypeRepr
2411- def right : TypeRepr
2412- end extension
2413- end OrTypeMethods
2414-
24152417 /** Type match `T match { case U => ... }` */
24162418 type MatchType <: TypeRepr
24172419
@@ -2573,8 +2575,32 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
25732575 end extension
25742576 end RecursiveTypeMethods
25752577
2578+ /** Type of the definition of a method taking a single list of type or term parameters */
2579+ type LambdaType <: TypeRepr
2580+
2581+ /** `TypeTest` that allows testing at runtime in a pattern match if a `TypeRepr` is a `LambdaType` */
2582+ given LambdaTypeTypeTest : TypeTest [TypeRepr , LambdaType ]
2583+
2584+ /** Makes extension methods on `LambdaType` available without any imports */
2585+ given LambdaTypeMethods : LambdaTypeMethods
2586+
2587+ /** Extension methods of `LambdaType` */
2588+ trait LambdaTypeMethods :
2589+ extension (self : LambdaType ):
2590+ def paramNames : List [String ]
2591+ def paramTypes : List [TypeRepr ]
2592+ def resType : TypeRepr
2593+ end extension
2594+ end LambdaTypeMethods
2595+
2596+ /** Type of the definition of a method taking a single list of type or term parameters */
2597+ type MethodOrPoly <: LambdaType
2598+
2599+ /** `TypeTest` that allows testing at runtime in a pattern match if a `TypeRepr` is a `MethodOrPoly` */
2600+ given MethodOrPolyTypeTest : TypeTest [TypeRepr , MethodOrPoly ]
2601+
25762602 /** Type of the definition of a method taking a single list of parameters. It's return type may be a MethodType. */
2577- type MethodType <: TypeRepr
2603+ type MethodType <: MethodOrPoly
25782604
25792605 /** `TypeTest` that allows testing at runtime in a pattern match if a `TypeRepr` is a `MethodType` */
25802606 given MethodTypeTypeTest : TypeTest [TypeRepr , MethodType ]
@@ -2597,14 +2623,11 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
25972623 def isImplicit : Boolean
25982624 def isErased : Boolean
25992625 def param (idx : Int ): TypeRepr
2600- def paramNames : List [String ]
2601- def paramTypes : List [TypeRepr ]
2602- def resType : TypeRepr
26032626 end extension
26042627 end MethodTypeMethods
26052628
26062629 /** Type of the definition of a method taking a list of type parameters. It's return type may be a MethodType. */
2607- type PolyType <: TypeRepr
2630+ type PolyType <: MethodOrPoly
26082631
26092632 /** `TypeTest` that allows testing at runtime in a pattern match if a `TypeRepr` is a `PolyType` */
26102633 given PolyTypeTypeTest : TypeTest [TypeRepr , PolyType ]
@@ -2625,14 +2648,12 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
26252648 trait PolyTypeMethods :
26262649 extension (self : PolyType ):
26272650 def param (idx : Int ): TypeRepr
2628- def paramNames : List [String ]
26292651 def paramBounds : List [TypeBounds ]
2630- def resType : TypeRepr
26312652 end extension
26322653 end PolyTypeMethods
26332654
26342655 /** Type of the definition of a type lambda taking a list of type parameters. It's return type may be a TypeLambda. */
2635- type TypeLambda <: TypeRepr
2656+ type TypeLambda <: LambdaType
26362657
26372658 /** `TypeTest` that allows testing at runtime in a pattern match if a `TypeRepr` is a `TypeLambda` */
26382659 given TypeLambdaTypeTest : TypeTest [TypeRepr , TypeLambda ]
@@ -2652,10 +2673,8 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
26522673 /** Extension methods of `TypeLambda` */
26532674 trait TypeLambdaMethods :
26542675 extension (self : TypeLambda ):
2655- def paramNames : List [String ]
2656- def paramBounds : List [TypeBounds ]
26572676 def param (idx : Int ) : TypeRepr
2658- def resType : TypeRepr
2677+ def paramBounds : List [ TypeBounds ]
26592678 end extension
26602679 end TypeLambdaMethods
26612680
0 commit comments