@@ -282,7 +282,7 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
282282
283283 def Ident_name (self : Ident ) given Context : String = self.name.show
284284
285- def Ident_apply (tmref : TermRef ) given Context : Term =
285+ def Ident_apply (tmref : NamedTermRef ) given Context : Term =
286286 withDefaultPos(tpd.ref(tmref).asInstanceOf [Term ])
287287
288288 def Ident_copy (original : Tree )(name : String ) given Context : Ident =
@@ -1145,32 +1145,53 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
11451145
11461146 def ConstantType_constant (self : ConstantType ) given Context : Constant = self.value
11471147
1148- type SymRef = Types .NamedType
1148+ type TermRef = Types .NamedType
11491149
1150- def matchSymRef (tpe : TypeOrBounds ) given Context : Option [SymRef ] = tpe match {
1150+ def matchTermRef (tpe : TypeOrBounds ) given Context : Option [TermRef ] = tpe match {
11511151 case tp : Types .NamedType =>
11521152 tp.designator match {
1153- case sym : Symbol => Some (tp)
1153+ case sym : Symbol if sym.isTerm => Some (tp)
11541154 case _ => None
11551155 }
11561156 case _ => None
11571157 }
11581158
1159- def SymRef_qualifier (self : SymRef ) given Context : TypeOrBounds = self.prefix
1159+ def TermRef_qualifier (self : TermRef ) given Context : TypeOrBounds = self.prefix
11601160
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 {
11631162 case tpe : Types .NamedType =>
11641163 tpe.designator match {
1165- case sym : Symbol => Some ((sym, tpe.prefix))
1164+ case sym : Symbol if sym.isTerm => Some ((sym, tpe.prefix))
11661165 case _ => None
11671166 }
11681167 case _ => None
11691168 }
11701169
1171- type TermRef = Types .NamedType
1170+ type TypeRef = Types .NamedType
11721171
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 {
11741195 case tpe : Types .NamedType =>
11751196 tpe.designator match {
11761197 case name : Names .TermName => Some (tpe)
@@ -1179,15 +1200,15 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
11791200 case _ => None
11801201 }
11811202
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
11841205
1185- def TermRef_apply (qual : TypeOrBounds , name : String ) given Context : TermRef =
1206+ def NamedTermRef_apply (qual : TypeOrBounds , name : String ) given Context : NamedTermRef =
11861207 Types .TermRef (qual, name.toTermName)
11871208
1188- type TypeRef = Types .NamedType
1209+ type NamedTypeRef = Types .NamedType
11891210
1190- def matchTypeRef (tpe : TypeOrBounds ) given Context : Option [TypeRef ] = tpe match {
1211+ def matchNamedTypeRef (tpe : TypeOrBounds ) given Context : Option [NamedTypeRef ] = tpe match {
11911212 case tpe : Types .NamedType =>
11921213 tpe.designator match {
11931214 case name : Names .TypeName => Some (tpe)
@@ -1196,8 +1217,8 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
11961217 case _ => None
11971218 }
11981219
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
12011222
12021223 type SuperType = Types .SuperType
12031224
0 commit comments