1
1
package dotty .tools .dotc .tastyreflect
2
2
3
- import dotty .tools .dotc .core .{Names , Types }
3
+ import dotty .tools .dotc .core .{Contexts , Names , Types }
4
4
5
5
trait TypeOrBoundsOpsImpl extends scala.tasty.reflect.TypeOrBoundsOps with CoreImpl {
6
6
@@ -41,13 +41,29 @@ trait TypeOrBoundsOpsImpl extends scala.tasty.reflect.TypeOrBoundsOps with CoreI
41
41
42
42
object Type extends TypeModule {
43
43
44
+ object IsConstantType extends IsConstantTypeModule {
45
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [ConstantType ] = ???
46
+ }
47
+
48
+ def ConstantTypeDeco (x : ConstantType ): ConstantTypeAPI = new ConstantTypeAPI {
49
+
50
+ }
51
+
44
52
object ConstantType extends ConstantTypeExtractor {
45
53
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [Constant ] = x match {
46
54
case Types .ConstantType (value) => Some (value)
47
55
case _ => None
48
56
}
49
57
}
50
58
59
+ object IsSymRef extends IsSymRefModule {
60
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [SymRef ] = ???
61
+ }
62
+
63
+ def SymRefDeco (x : SymRef ): SymRefAPI = new SymRefAPI {
64
+
65
+ }
66
+
51
67
object SymRef extends SymRefExtractor {
52
68
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [(Symbol , TypeOrBounds /* Type | NoPrefix */ )] = x match {
53
69
case tp : Types .NamedType =>
@@ -59,6 +75,14 @@ trait TypeOrBoundsOpsImpl extends scala.tasty.reflect.TypeOrBoundsOps with CoreI
59
75
}
60
76
}
61
77
78
+ object IsTermRef extends IsTermRefModule {
79
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [TermRef ] = ???
80
+ }
81
+
82
+ def TermRefDeco (x : TermRef ): TermRefAPI = new TermRefAPI {
83
+
84
+ }
85
+
62
86
object TermRef extends TermRefExtractor {
63
87
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [(String , TypeOrBounds /* Type | NoPrefix */ )] = x match {
64
88
case tp : Types .NamedType =>
@@ -70,6 +94,14 @@ trait TypeOrBoundsOpsImpl extends scala.tasty.reflect.TypeOrBoundsOps with CoreI
70
94
}
71
95
}
72
96
97
+ object IsTypeRef extends IsTypeRefModule {
98
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [TypeRef ] = ???
99
+ }
100
+
101
+ def TypeRefDeco (x : TypeRef ): TypeRefAPI = new TypeRefAPI {
102
+
103
+ }
104
+
73
105
object TypeRef extends TypeRefExtractor {
74
106
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [(String , TypeOrBounds /* Type | NoPrefix */ )] = x match {
75
107
case tp : Types .NamedType =>
@@ -81,62 +113,134 @@ trait TypeOrBoundsOpsImpl extends scala.tasty.reflect.TypeOrBoundsOps with CoreI
81
113
}
82
114
}
83
115
116
+ object IsSuperType extends IsSuperTypeModule {
117
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [SuperType ] = ???
118
+ }
119
+
120
+ def SuperTypeDeco (x : SuperType ): SuperTypeAPI = new SuperTypeAPI {
121
+
122
+ }
123
+
84
124
object SuperType extends SuperTypeExtractor {
85
125
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [(Type , Type )] = x match {
86
126
case Types .SuperType (thistpe, supertpe) => Some (thistpe, supertpe)
87
127
case _ => None
88
128
}
89
129
}
90
130
131
+ object IsRefinement extends IsRefinementModule {
132
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [Refinement ] = ???
133
+ }
134
+
135
+ def RefinementDeco (x : Refinement ): RefinementAPI = new RefinementAPI {
136
+
137
+ }
138
+
91
139
object Refinement extends RefinementExtractor {
92
140
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [(Type , String , TypeOrBounds /* Type | TypeBounds */ )] = x match {
93
141
case Types .RefinedType (parent, name, info) => Some (parent, name.toString, info)
94
142
case _ => None
95
143
}
96
144
}
97
145
146
+ object IsAppliedType extends IsAppliedTypeModule {
147
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [AppliedType ] = ???
148
+ }
149
+
150
+ def AppliedTypeDeco (x : AppliedType ): AppliedTypeAPI = new AppliedTypeAPI {
151
+
152
+ }
153
+
98
154
object AppliedType extends AppliedTypeExtractor {
99
155
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [(Type , List [TypeOrBounds /* Type | TypeBounds */ ])] = x match {
100
156
case Types .AppliedType (tycon, args) => Some ((tycon.stripTypeVar, args.map(_.stripTypeVar)))
101
157
case _ => None
102
158
}
103
159
}
104
160
161
+ object IsAnnotatedType extends IsAnnotatedTypeModule {
162
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [AnnotatedType ] = ???
163
+ }
164
+
165
+ def AnnotatedTypeDeco (x : AnnotatedType ): AnnotatedTypeAPI = new AnnotatedTypeAPI {
166
+
167
+ }
168
+
105
169
object AnnotatedType extends AnnotatedTypeExtractor {
106
170
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [(Type , Term )] = x match {
107
171
case Types .AnnotatedType (underlying, annot) => Some ((underlying.stripTypeVar, annot.tree))
108
172
case _ => None
109
173
}
110
174
}
111
175
176
+ object IsAndType extends IsAndTypeModule {
177
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [AndType ] = ???
178
+ }
179
+
180
+ def AndTypeDeco (x : AndType ): AndTypeAPI = new AndTypeAPI {
181
+
182
+ }
183
+
112
184
object AndType extends AndTypeExtractor {
113
185
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [(Type , Type )] = x match {
114
186
case Types .AndType (left, right) => Some (left.stripTypeVar, right.stripTypeVar)
115
187
case _ => None
116
188
}
117
189
}
118
190
191
+ object IsOrType extends IsOrTypeModule {
192
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [OrType ] = ???
193
+ }
194
+
195
+ def OrTypeDeco (x : OrType ): OrTypeAPI = new OrTypeAPI {
196
+
197
+ }
198
+
119
199
object OrType extends OrTypeExtractor {
120
200
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [(Type , Type )] = x match {
121
201
case Types .OrType (left, right) => Some (left.stripTypeVar, right.stripTypeVar)
122
202
case _ => None
123
203
}
124
204
}
125
205
206
+ object IsMatchType extends IsMatchTypeModule {
207
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [MatchType ] = ???
208
+ }
209
+
210
+ def MatchTypeDeco (x : MatchType ): MatchTypeAPI = new MatchTypeAPI {
211
+
212
+ }
213
+
126
214
object MatchType extends MatchTypeExtractor {
127
215
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [(Type , Type , List [Type ])] = x match {
128
216
case Types .MatchType (bound, scrutinee, cases) => Some ((bound, scrutinee, cases))
129
217
case _ => None
130
218
}
131
219
}
132
220
221
+ object IsByNameType extends IsByNameTypeModule {
222
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [ByNameType ] = ???
223
+ }
224
+
225
+ def ByNameTypeDeco (x : ByNameType ): ByNameTypeAPI = new ByNameTypeAPI {
226
+
227
+ }
228
+
133
229
object ByNameType extends ByNameTypeExtractor {
134
230
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [Type ] = x match {
135
231
case Types .ExprType (resType) => Some (resType.stripTypeVar)
136
232
case _ => None
137
233
}
138
234
}
139
235
236
+ object IsParamRef extends IsParamRefModule {
237
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [ParamRef ] = ???
238
+ }
239
+
240
+ def ParamRefDeco (x : ParamRef ): ParamRefAPI = new ParamRefAPI {
241
+
242
+ }
243
+
140
244
object ParamRef extends ParamRefExtractor {
141
245
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [(LambdaType [TypeOrBounds ], Int )] = x match {
142
246
case Types .TypeParamRef (binder, idx) =>
@@ -148,41 +252,89 @@ trait TypeOrBoundsOpsImpl extends scala.tasty.reflect.TypeOrBoundsOps with CoreI
148
252
}
149
253
}
150
254
255
+ object IsThisType extends IsThisTypeModule {
256
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [ThisType ] = ???
257
+ }
258
+
259
+ def ThisTypeDeco (x : ThisType ): ThisTypeAPI = new ThisTypeAPI {
260
+
261
+ }
262
+
151
263
object ThisType extends ThisTypeExtractor {
152
264
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [Type ] = x match {
153
265
case Types .ThisType (tp) => Some (tp)
154
266
case _ => None
155
267
}
156
268
}
157
269
270
+ object IsRecursiveThis extends IsRecursiveThisModule {
271
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [RecursiveThis ] = ???
272
+ }
273
+
274
+ def RecursiveThisDeco (x : RecursiveThis ): RecursiveThisAPI = new RecursiveThisAPI {
275
+
276
+ }
277
+
158
278
object RecursiveThis extends RecursiveThisExtractor {
159
279
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [RecursiveType ] = x match {
160
280
case Types .RecThis (binder) => Some (binder)
161
281
case _ => None
162
282
}
163
283
}
164
284
285
+ object IsRecursiveType extends IsRecursiveTypeModule {
286
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [RecursiveType ] = ???
287
+ }
288
+
289
+ def RecursiveTypeDeco (x : RecursiveType ): RecursiveTypeAPI = new RecursiveTypeAPI {
290
+
291
+ }
292
+
165
293
object RecursiveType extends RecursiveTypeExtractor {
166
294
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [Type ] = x match {
167
295
case tp : Types .RecType => Some (tp.underlying.stripTypeVar)
168
296
case _ => None
169
297
}
170
298
}
171
299
300
+ object IsMethodType extends IsMethodTypeModule {
301
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [MethodType ] = ???
302
+ }
303
+
304
+ def MethodTypeDeco (x : MethodType ): MethodTypeAPI = new MethodTypeAPI {
305
+
306
+ }
307
+
172
308
object MethodType extends MethodTypeExtractor {
173
309
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [(List [String ], List [Type ], Type )] = x match {
174
310
case x : MethodType => Some (x.paramNames.map(_.toString), x.paramInfos, x.resType)
175
311
case _ => None
176
312
}
177
313
}
178
314
315
+ object IsPolyType extends IsPolyTypeModule {
316
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [PolyType ] = ???
317
+ }
318
+
319
+ def PolyTypeDeco (x : PolyType ): PolyTypeAPI = new PolyTypeAPI {
320
+
321
+ }
322
+
179
323
object PolyType extends PolyTypeExtractor {
180
324
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [(List [String ], List [TypeBounds ], Type )] = x match {
181
325
case x : PolyType => Some (x.paramNames.map(_.toString), x.paramInfos, x.resType)
182
326
case _ => None
183
327
}
184
328
}
185
329
330
+ object IsTypeLambda extends IsTypeLambdaModule {
331
+ def unapply (tree : Tree )(implicit ctx : Context ): Option [TypeLambda ] = ???
332
+ }
333
+
334
+ def TypeLambdaDeco (x : TypeLambda ): TypeLambdaAPI = new TypeLambdaAPI {
335
+
336
+ }
337
+
186
338
object TypeLambda extends TypeLambdaExtractor {
187
339
def unapply (x : TypeOrBounds )(implicit ctx : Context ): Option [(List [String ], List [TypeBounds ], Type )] = x match {
188
340
case x : TypeLambda => Some (x.paramNames.map(_.toString), x.paramInfos, x.resType)
0 commit comments