@@ -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 : TermRef ) given Context : Term =
285
+ def Ident_apply (tmref : NamedTermRef ) 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 =
@@ -1145,32 +1145,53 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
1145
1145
1146
1146
def ConstantType_constant (self : ConstantType ) given Context : Constant = self.value
1147
1147
1148
- type SymRef = Types .NamedType
1148
+ type TermRef = Types .NamedType
1149
1149
1150
- def matchSymRef (tpe : TypeOrBounds ) given Context : Option [SymRef ] = tpe match {
1150
+ def matchTermRef (tpe : TypeOrBounds ) given Context : Option [TermRef ] = tpe match {
1151
1151
case tp : Types .NamedType =>
1152
1152
tp.designator match {
1153
- case sym : Symbol => Some (tp)
1153
+ case sym : Symbol if sym.isTerm => Some (tp)
1154
1154
case _ => None
1155
1155
}
1156
1156
case _ => None
1157
1157
}
1158
1158
1159
- def SymRef_qualifier (self : SymRef ) given Context : TypeOrBounds = self.prefix
1159
+ def TermRef_qualifier (self : TermRef ) given Context : TypeOrBounds = self.prefix
1160
1160
1161
- // TODO remove this method. May require splitting SymRef into TypeSymRef and TermSymRef
1162
- def matchSymRef_unapply (tpe : TypeOrBounds ) given Context : Option [(Symbol , Type | NoPrefix )] = tpe match {
1161
+ def matchTermRef_unapply (tpe : TypeOrBounds ) given Context : Option [(Symbol , Type | NoPrefix )] = tpe match {
1163
1162
case tpe : Types .NamedType =>
1164
1163
tpe.designator match {
1165
- case sym : Symbol => Some ((sym, tpe.prefix))
1164
+ case sym : Symbol if sym.isTerm => Some ((sym, tpe.prefix))
1166
1165
case _ => None
1167
1166
}
1168
1167
case _ => None
1169
1168
}
1170
1169
1171
- type TermRef = Types .NamedType
1170
+ type TypeRef = Types .NamedType
1172
1171
1173
- def matchTermRef (tpe : TypeOrBounds ) given Context : Option [TermRef ] = tpe match {
1172
+ 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
+ }
1178
+ case _ => None
1179
+ }
1180
+
1181
+ def TypeRef_qualifier (self : TypeRef ) given Context : TypeOrBounds = self.prefix
1182
+
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
+ }
1191
+
1192
+ type NamedTermRef = Types .NamedType
1193
+
1194
+ def matchNamedTermRef (tpe : TypeOrBounds ) given Context : Option [NamedTermRef ] = tpe match {
1174
1195
case tpe : Types .NamedType =>
1175
1196
tpe.designator match {
1176
1197
case name : Names .TermName => Some (tpe)
@@ -1179,15 +1200,15 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
1179
1200
case _ => None
1180
1201
}
1181
1202
1182
- def TermRef_name (self : TermRef ) given Context : String = self.name.toString
1183
- def TermRef_qualifier (self : TermRef ) given Context : TypeOrBounds = self.prefix
1203
+ def NamedTermRef_name (self : NamedTermRef ) given Context : String = self.name.toString
1204
+ def NamedTermRef_qualifier (self : NamedTermRef ) given Context : TypeOrBounds = self.prefix
1184
1205
1185
- def TermRef_apply (qual : TypeOrBounds , name : String ) given Context : TermRef =
1206
+ def NamedTermRef_apply (qual : TypeOrBounds , name : String ) given Context : NamedTermRef =
1186
1207
Types .TermRef (qual, name.toTermName)
1187
1208
1188
- type TypeRef = Types .NamedType
1209
+ type NamedTypeRef = Types .NamedType
1189
1210
1190
- def matchTypeRef (tpe : TypeOrBounds ) given Context : Option [TypeRef ] = tpe match {
1211
+ def matchNamedTypeRef (tpe : TypeOrBounds ) given Context : Option [NamedTypeRef ] = tpe match {
1191
1212
case tpe : Types .NamedType =>
1192
1213
tpe.designator match {
1193
1214
case name : Names .TypeName => Some (tpe)
@@ -1196,8 +1217,8 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
1196
1217
case _ => None
1197
1218
}
1198
1219
1199
- def TypeRef_name (self : TypeRef ) given Context : String = self.name.toString
1200
- def TypeRef_qualifier (self : TypeRef ) given Context : TypeOrBounds = self.prefix
1220
+ def NamedTypeRef_name (self : NamedTypeRef ) given Context : String = self.name.toString
1221
+ def NamedTypeRef_qualifier (self : NamedTypeRef ) given Context : TypeOrBounds = self.prefix
1201
1222
1202
1223
type SuperType = Types .SuperType
1203
1224
0 commit comments