@@ -271,7 +271,7 @@ class KernelImpl(val rootContext: core.Contexts.Context) extends Kernel {
271
271
272
272
def Ident_name (self : Ident ) given Context : String = self.name.show
273
273
274
- def Ident_apply (tmref : TermRef ) given Context : Term =
274
+ def Ident_apply (tmref : NamedTermRef ) given Context : Term =
275
275
withDefaultPos(tpd.ref(tmref).asInstanceOf [Term ])
276
276
277
277
def Ident_copy (original : Tree )(name : String ) given Context : Ident =
@@ -1134,32 +1134,53 @@ class KernelImpl(val rootContext: core.Contexts.Context) extends Kernel {
1134
1134
1135
1135
def ConstantType_constant (self : ConstantType ) given Context : Constant = self.value
1136
1136
1137
- type SymRef = Types .NamedType
1137
+ type SymTermRef = Types .NamedType
1138
1138
1139
- def matchSymRef (tpe : TypeOrBounds ) given Context : Option [SymRef ] = tpe match {
1139
+ def matchSymTermRef (tpe : TypeOrBounds ) given Context : Option [SymTermRef ] = tpe match {
1140
1140
case tp : Types .NamedType =>
1141
1141
tp.designator match {
1142
- case sym : Symbol => Some (tp)
1142
+ case sym : Symbol if sym.isTerm => Some (tp)
1143
1143
case _ => None
1144
1144
}
1145
1145
case _ => None
1146
1146
}
1147
1147
1148
- def SymRef_qualifier (self : SymRef ) given Context : TypeOrBounds = self.prefix
1148
+ def SymTermRef_qualifier (self : SymTermRef ) given Context : TypeOrBounds = self.prefix
1149
1149
1150
- // TODO remove this method. May require splitting SymRef into TypeSymRef and TermSymRef
1151
- def matchSymRef_unapply (tpe : TypeOrBounds ) given Context : Option [(Symbol , Type | NoPrefix )] = tpe match {
1150
+ def matchSymTermRef_unapply (tpe : TypeOrBounds ) given Context : Option [(Symbol , Type | NoPrefix )] = tpe match {
1152
1151
case tpe : Types .NamedType =>
1153
1152
tpe.designator match {
1154
- case sym : Symbol => Some ((sym, tpe.prefix))
1153
+ case sym : Symbol if sym.isTerm => Some ((sym, tpe.prefix))
1155
1154
case _ => None
1156
1155
}
1157
1156
case _ => None
1158
1157
}
1159
1158
1160
- type TermRef = Types .NamedType
1159
+ type SymTypeRef = Types .NamedType
1161
1160
1162
- def matchTermRef (tpe : TypeOrBounds ) given Context : Option [TermRef ] = tpe match {
1161
+ def matchSymTypeRef (tpe : TypeOrBounds ) given Context : Option [SymTypeRef ] = tpe match {
1162
+ case tp : Types .NamedType =>
1163
+ tp.designator match {
1164
+ case sym : Symbol if sym.isType => Some (tp)
1165
+ case _ => None
1166
+ }
1167
+ case _ => None
1168
+ }
1169
+
1170
+ def SymTypeRef_qualifier (self : SymTypeRef ) given Context : TypeOrBounds = self.prefix
1171
+
1172
+ def matchSymTypeRef_unapply (tpe : TypeOrBounds ) given Context : Option [(Symbol , Type | NoPrefix )] = tpe match {
1173
+ case tpe : Types .NamedType =>
1174
+ tpe.designator match {
1175
+ case sym : Symbol if sym.isType => Some ((sym, tpe.prefix))
1176
+ case _ => None
1177
+ }
1178
+ case _ => None
1179
+ }
1180
+
1181
+ type NamedTermRef = Types .NamedType
1182
+
1183
+ def matchNamedTermRef (tpe : TypeOrBounds ) given Context : Option [NamedTermRef ] = tpe match {
1163
1184
case tpe : Types .NamedType =>
1164
1185
tpe.designator match {
1165
1186
case name : Names .TermName => Some (tpe)
@@ -1168,15 +1189,15 @@ class KernelImpl(val rootContext: core.Contexts.Context) extends Kernel {
1168
1189
case _ => None
1169
1190
}
1170
1191
1171
- def TermRef_name (self : TermRef ) given Context : String = self.name.toString
1172
- def TermRef_qualifier (self : TermRef ) given Context : TypeOrBounds = self.prefix
1192
+ def NamedTermRef_name (self : NamedTermRef ) given Context : String = self.name.toString
1193
+ def NamedTermRef_qualifier (self : NamedTermRef ) given Context : TypeOrBounds = self.prefix
1173
1194
1174
- def TermRef_apply (qual : TypeOrBounds , name : String ) given Context : TermRef =
1195
+ def NamedTermRef_apply (qual : TypeOrBounds , name : String ) given Context : NamedTermRef =
1175
1196
Types .TermRef (qual, name.toTermName)
1176
1197
1177
- type TypeRef = Types .NamedType
1198
+ type NamedTypeRef = Types .NamedType
1178
1199
1179
- def matchTypeRef (tpe : TypeOrBounds ) given Context : Option [TypeRef ] = tpe match {
1200
+ def matchNamedTypeRef (tpe : TypeOrBounds ) given Context : Option [NamedTypeRef ] = tpe match {
1180
1201
case tpe : Types .NamedType =>
1181
1202
tpe.designator match {
1182
1203
case name : Names .TypeName => Some (tpe)
@@ -1185,8 +1206,8 @@ class KernelImpl(val rootContext: core.Contexts.Context) extends Kernel {
1185
1206
case _ => None
1186
1207
}
1187
1208
1188
- def TypeRef_name (self : TypeRef ) given Context : String = self.name.toString
1189
- def TypeRef_qualifier (self : TypeRef ) given Context : TypeOrBounds = self.prefix
1209
+ def NamedTypeRef_name (self : NamedTypeRef ) given Context : String = self.name.toString
1210
+ def NamedTypeRef_qualifier (self : NamedTypeRef ) given Context : TypeOrBounds = self.prefix
1190
1211
1191
1212
type SuperType = Types .SuperType
1192
1213
0 commit comments