@@ -282,7 +282,7 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
282
282
283
283
def Ident_name (self : Ident ) given Context : String = self.name.show
284
284
285
- def Ident_apply (tmref : NamedTermRef ) given Context : Term =
285
+ def Ident_apply (tmref : TermRef ) given Context : Term =
286
286
withDefaultPos(tpd.ref(tmref).asInstanceOf [Term ])
287
287
288
288
def Ident_copy (original : Tree )(name : String ) given Context : Ident =
@@ -1114,6 +1114,8 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
1114
1114
1115
1115
def Type_typeSymbol (self : Type ) given Context : Symbol = self.typeSymbol
1116
1116
1117
+ def Type_termSymbol (self : Type ) given Context : Symbol = self.termSymbol
1118
+
1117
1119
def Type_isSingleton (self : Type ) given Context : Boolean = self.isSingleton
1118
1120
1119
1121
def Type_memberType (self : Type )(member : Symbol ) given Context : Type =
@@ -1148,46 +1150,27 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
1148
1150
type TermRef = Types .NamedType
1149
1151
1150
1152
def matchTermRef (tpe : TypeOrBounds ) given Context : Option [TermRef ] = tpe match {
1151
- case tp : Types .NamedType =>
1152
- tp.designator match {
1153
- case sym : Symbol if sym.isTerm => Some (tp)
1154
- case _ => None
1155
- }
1153
+ case tp : Types .TermRef => Some (tp)
1156
1154
case _ => None
1157
1155
}
1158
1156
1157
+ def TermRef_apply (qual : TypeOrBounds , name : String ) given Context : TermRef =
1158
+ Types .TermRef (qual, name.toTermName)
1159
+
1159
1160
def TermRef_qualifier (self : TermRef ) given Context : TypeOrBounds = self.prefix
1160
1161
1161
- def matchTermRef_unapply (tpe : TypeOrBounds ) given Context : Option [(Symbol , Type | NoPrefix )] = tpe match {
1162
- case tpe : Types .NamedType =>
1163
- tpe.designator match {
1164
- case sym : Symbol if sym.isTerm => Some ((sym, tpe.prefix))
1165
- case _ => None
1166
- }
1167
- case _ => None
1168
- }
1162
+ def TermRef_name (self : TermRef ) given Context : String = self.name.toString
1169
1163
1170
1164
type TypeRef = Types .NamedType
1171
1165
1172
1166
def matchTypeRef (tpe : TypeOrBounds ) given Context : Option [TypeRef ] = tpe match {
1173
- case tp : Types .NamedType =>
1174
- tp.designator match {
1175
- case sym : Symbol if sym.isType => Some (tp)
1176
- case _ => None
1177
- }
1167
+ case tp : Types .TypeRef => Some (tp)
1178
1168
case _ => None
1179
1169
}
1180
1170
1181
1171
def TypeRef_qualifier (self : TypeRef ) given Context : TypeOrBounds = self.prefix
1182
1172
1183
- def matchTypeRef_unapply (tpe : TypeOrBounds ) given Context : Option [(Symbol , Type | NoPrefix )] = tpe match {
1184
- case tpe : Types .NamedType =>
1185
- tpe.designator match {
1186
- case sym : Symbol if sym.isType => Some ((sym, tpe.prefix))
1187
- case _ => None
1188
- }
1189
- case _ => None
1190
- }
1173
+ def TypeRef_name (self : TypeRef ) given Context : String = self.name.toString
1191
1174
1192
1175
type NamedTermRef = Types .NamedType
1193
1176
@@ -1203,23 +1186,6 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
1203
1186
def NamedTermRef_name (self : NamedTermRef ) given Context : String = self.name.toString
1204
1187
def NamedTermRef_qualifier (self : NamedTermRef ) given Context : TypeOrBounds = self.prefix
1205
1188
1206
- def NamedTermRef_apply (qual : TypeOrBounds , name : String ) given Context : NamedTermRef =
1207
- Types .TermRef (qual, name.toTermName)
1208
-
1209
- type NamedTypeRef = Types .NamedType
1210
-
1211
- def matchNamedTypeRef (tpe : TypeOrBounds ) given Context : Option [NamedTypeRef ] = tpe match {
1212
- case tpe : Types .NamedType =>
1213
- tpe.designator match {
1214
- case name : Names .TypeName => Some (tpe)
1215
- case _ => None
1216
- }
1217
- case _ => None
1218
- }
1219
-
1220
- def NamedTypeRef_name (self : NamedTypeRef ) given Context : String = self.name.toString
1221
- def NamedTypeRef_qualifier (self : NamedTypeRef ) given Context : TypeOrBounds = self.prefix
1222
-
1223
1189
type SuperType = Types .SuperType
1224
1190
1225
1191
def matchSuperType (tpe : TypeOrBounds ) given Context : Option [SuperType ] = tpe match {
0 commit comments