@@ -308,8 +308,8 @@ trait Printers
308
308
def visitType (x : TypeOrBounds ): Buffer = x match {
309
309
case Type .ConstantType (value) =>
310
310
this += " Type.ConstantType(" += value += " )"
311
- case Type .TermRef (sym, qual ) =>
312
- this += " Type.TermRef(" += sym += " , " += qual += " )"
311
+ case Type .TermRef (qual, name ) =>
312
+ this += " Type.TermRef(" += qual += " , \" " += name += " \ " )"
313
313
case Type .TypeRef (sym, qual) =>
314
314
this += " Type.TypeRef(" += sym += " , " += qual += " )"
315
315
case Type .NamedTermRef (name, qual) =>
@@ -1423,10 +1423,10 @@ trait Printers
1423
1423
case Type .TypeRef (IsClassDefSymbol (sym), _) if sym.fullName == " scala.runtime.Null$" || sym.fullName == " scala.runtime.Nothing$" =>
1424
1424
// scala.runtime.Null$ and scala.runtime.Nothing$ are not modules, those are their actual names
1425
1425
printType(tpe)
1426
- case tpe @ Type .TermRef ( IsClassDefSymbol (sym), _) if sym .name.endsWith(" $" ) =>
1426
+ case Type .IsTermRef (tpe) if tpe.termSymbol.isClass && tpe.termSymbol .name.endsWith(" $" ) =>
1427
1427
printType(tpe)
1428
1428
this += " .type"
1429
- case tpe @ Type .TypeRef ( IsClassDefSymbol (sym), _) if sym .name.endsWith(" $" ) =>
1429
+ case Type .IsTypeRef (tpe) if tpe.typeSymbol.isClass && tpe.typeSymbol .name.endsWith(" $" ) =>
1430
1430
printType(tpe)
1431
1431
this += " .type"
1432
1432
case tpe @ Type .TermRef (sym, _) =>
@@ -1519,8 +1519,9 @@ trait Printers
1519
1519
case Type .ConstantType (const) =>
1520
1520
printConstant(const)
1521
1521
1522
- case Type .TypeRef (sym, prefix) =>
1523
- prefix match {
1522
+ case Type .IsTypeRef (tpe) =>
1523
+ val sym = tpe.typeSymbol
1524
+ tpe.qualifier match {
1524
1525
case Type .ThisType (Types .EmptyPackage () | Types .RootPackage ()) =>
1525
1526
case NoPrefix () =>
1526
1527
if (sym.owner.flags.is(Flags .Package )) {
@@ -1529,7 +1530,7 @@ trait Printers
1529
1530
if (packagePath != " " )
1530
1531
this += packagePath += " ."
1531
1532
}
1532
- case IsType (prefix @ Type .TermRef ( IsClassDefSymbol (_), _)) =>
1533
+ case Type .IsTermRef (prefix) if prefix.termSymbol.isClass =>
1533
1534
printType(prefix)
1534
1535
this += " #"
1535
1536
case IsType (prefix @ Type .TypeRef (IsClassDefSymbol (_), _)) =>
@@ -1543,14 +1544,14 @@ trait Printers
1543
1544
}
1544
1545
this += highlightTypeDef(sym.name.stripSuffix(" $" ))
1545
1546
1546
- case Type .TermRef (sym, prefix ) =>
1547
+ case Type .TermRef (prefix, name ) =>
1547
1548
prefix match {
1548
1549
case NoPrefix () | Type .ThisType (Types .EmptyPackage () | Types .RootPackage ()) =>
1549
- this += highlightTypeDef(sym. name)
1550
+ this += highlightTypeDef(name)
1550
1551
case _ =>
1551
1552
printTypeOrBound(prefix)
1552
- if (sym. name != " package" )
1553
- this += " ." += highlightTypeDef(sym. name)
1553
+ if (name != " package" )
1554
+ this += " ." += highlightTypeDef(name)
1554
1555
this
1555
1556
}
1556
1557
@@ -1706,8 +1707,8 @@ trait Printers
1706
1707
val annots = definition.symbol.annots.filter {
1707
1708
case Annotation (annot, _) =>
1708
1709
annot.tpe match {
1709
- case Type .NamedTypeRef (_, Type .TermRef (sym, _ )) if sym .fullName == " scala.annotation.internal" => false
1710
- case Type .NamedTypeRef (_, Type .TypeRef (sym, _ )) if sym .fullName == " scala.annotation.internal" => false
1710
+ case Type .NamedTypeRef (_, Type .IsTermRef (prefix )) if prefix.termSymbol .fullName == " scala.annotation.internal" => false
1711
+ case Type .NamedTypeRef (_, Type .IsTypeRef (prefix )) if prefix.typeSymbol .fullName == " scala.annotation.internal" => false
1711
1712
case Type .NamedTypeRef (" forceInline" , Types .ScalaPackage ()) => false
1712
1713
case _ => true
1713
1714
}
@@ -1871,8 +1872,8 @@ trait Printers
1871
1872
def unapply (arg : Tree ) given (ctx : Context ): Option [(String , List [Term ])] = arg match {
1872
1873
case IsTerm (arg @ Apply (fn, args)) =>
1873
1874
fn.tpe match {
1874
- case Type .TermRef (IsDefDefSymbol (sym), Type .ThisType (Type .TypeRef (sym2, _))) if sym2.name == " <special-ops>" =>
1875
- Some ((sym .tree.name, args))
1875
+ case tpe @ Type .TermRef (Type .ThisType (Type .TypeRef (sym2, _)), _ ) if sym2.name == " <special-ops>" =>
1876
+ Some ((tpe.termSymbol.asDefDef .tree.name, args))
1876
1877
case _ => None
1877
1878
}
1878
1879
case _ => None
@@ -1893,23 +1894,23 @@ trait Printers
1893
1894
1894
1895
object JavaLangObject {
1895
1896
def unapply (tpe : Type ) given (ctx : Context ): Boolean = tpe match {
1896
- case Type .NamedTypeRef (" Object" , Type .TermRef (sym, _ )) => sym .fullName == " java.lang"
1897
+ case Type .NamedTypeRef (" Object" , Type .IsTermRef (prefix )) => prefix.typeSymbol .fullName == " java.lang"
1897
1898
case _ => false
1898
1899
}
1899
1900
}
1900
1901
1901
1902
object Sequence {
1902
1903
def unapply (tpe : Type ) given (ctx : Context ): Option [Type ] = tpe match {
1903
- case Type .AppliedType (Type .NamedTypeRef (" Seq" , Type .TermRef (sym, _ )), IsType (tp) :: Nil ) if sym .fullName == " scala.collection" => Some (tp)
1904
- case Type .AppliedType (Type .NamedTypeRef (" Seq" , Type .TypeRef (sym, _ )), IsType (tp) :: Nil ) if sym .fullName == " scala.collection" => Some (tp)
1904
+ case Type .AppliedType (Type .NamedTypeRef (" Seq" , Type .IsTermRef (prefix )), IsType (tp) :: Nil ) if prefix.termSymbol .fullName == " scala.collection" => Some (tp)
1905
+ case Type .AppliedType (Type .NamedTypeRef (" Seq" , Type .IsTypeRef (prefix )), IsType (tp) :: Nil ) if prefix.typeSymbol .fullName == " scala.collection" => Some (tp)
1905
1906
case _ => None
1906
1907
}
1907
1908
}
1908
1909
1909
1910
object RepeatedAnnotation {
1910
1911
def unapply (tpe : Type ) given (ctx : Context ): Boolean = tpe match {
1911
- case Type .NamedTypeRef (" Repeated" , Type .TermRef (sym, _ )) => sym .fullName == " scala.annotation.internal"
1912
- case Type .NamedTypeRef (" Repeated" , Type .TypeRef (sym, _ )) => sym .fullName == " scala.annotation.internal"
1912
+ case Type .NamedTypeRef (" Repeated" , Type .IsTermRef (prefix )) => prefix.termSymbol .fullName == " scala.annotation.internal"
1913
+ case Type .NamedTypeRef (" Repeated" , Type .IsTypeRef (prefix )) => prefix.typeSymbol .fullName == " scala.annotation.internal"
1913
1914
case _ => false
1914
1915
}
1915
1916
}
@@ -1923,21 +1924,21 @@ trait Printers
1923
1924
1924
1925
object ScalaPackage {
1925
1926
def unapply (tpe : TypeOrBounds ) given (ctx : Context ): Boolean = tpe match {
1926
- case Type .TermRef (sym, _ ) => sym == definitions.ScalaPackage
1927
+ case Type .IsTermRef (tpe ) => tpe.termSymbol == definitions.ScalaPackage
1927
1928
case _ => false
1928
1929
}
1929
1930
}
1930
1931
1931
1932
object RootPackage {
1932
1933
def unapply (tpe : TypeOrBounds ) given (ctx : Context ): Boolean = tpe match {
1933
- case Type .TypeRef (sym, _ ) => sym .fullName == " <root>" // TODO use Symbol.==
1934
+ case Type .IsTypeRef (tpe ) => tpe.typeSymbol .fullName == " <root>" // TODO use Symbol.==
1934
1935
case _ => false
1935
1936
}
1936
1937
}
1937
1938
1938
1939
object EmptyPackage {
1939
1940
def unapply (tpe : TypeOrBounds ) given (ctx : Context ): Boolean = tpe match {
1940
- case Type .TypeRef (sym, _ ) => sym .fullName == " <empty>"
1941
+ case Type .IsTypeRef (tpe ) => tpe.typeSymbol .fullName == " <empty>"
1941
1942
case _ => false
1942
1943
}
1943
1944
}
0 commit comments