@@ -308,8 +308,8 @@ trait Printers
308308 def visitType (x : TypeOrBounds ): Buffer = x match {
309309 case Type .ConstantType (value) =>
310310 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 += " \ " )"
313313 case Type .TypeRef (sym, qual) =>
314314 this += " Type.TypeRef(" += sym += " , " += qual += " )"
315315 case Type .NamedTermRef (name, qual) =>
@@ -1423,10 +1423,10 @@ trait Printers
14231423 case Type .TypeRef (IsClassDefSymbol (sym), _) if sym.fullName == " scala.runtime.Null$" || sym.fullName == " scala.runtime.Nothing$" =>
14241424 // scala.runtime.Null$ and scala.runtime.Nothing$ are not modules, those are their actual names
14251425 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(" $" ) =>
14271427 printType(tpe)
14281428 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(" $" ) =>
14301430 printType(tpe)
14311431 this += " .type"
14321432 case tpe @ Type .TermRef (sym, _) =>
@@ -1519,8 +1519,9 @@ trait Printers
15191519 case Type .ConstantType (const) =>
15201520 printConstant(const)
15211521
1522- case Type .TypeRef (sym, prefix) =>
1523- prefix match {
1522+ case Type .IsTypeRef (tpe) =>
1523+ val sym = tpe.typeSymbol
1524+ tpe.qualifier match {
15241525 case Type .ThisType (Types .EmptyPackage () | Types .RootPackage ()) =>
15251526 case NoPrefix () =>
15261527 if (sym.owner.flags.is(Flags .Package )) {
@@ -1529,7 +1530,7 @@ trait Printers
15291530 if (packagePath != " " )
15301531 this += packagePath += " ."
15311532 }
1532- case IsType (prefix @ Type .TermRef ( IsClassDefSymbol (_), _)) =>
1533+ case Type .IsTermRef (prefix) if prefix.termSymbol.isClass =>
15331534 printType(prefix)
15341535 this += " #"
15351536 case IsType (prefix @ Type .TypeRef (IsClassDefSymbol (_), _)) =>
@@ -1543,14 +1544,14 @@ trait Printers
15431544 }
15441545 this += highlightTypeDef(sym.name.stripSuffix(" $" ))
15451546
1546- case Type .TermRef (sym, prefix ) =>
1547+ case Type .TermRef (prefix, name ) =>
15471548 prefix match {
15481549 case NoPrefix () | Type .ThisType (Types .EmptyPackage () | Types .RootPackage ()) =>
1549- this += highlightTypeDef(sym. name)
1550+ this += highlightTypeDef(name)
15501551 case _ =>
15511552 printTypeOrBound(prefix)
1552- if (sym. name != " package" )
1553- this += " ." += highlightTypeDef(sym. name)
1553+ if (name != " package" )
1554+ this += " ." += highlightTypeDef(name)
15541555 this
15551556 }
15561557
@@ -1706,8 +1707,8 @@ trait Printers
17061707 val annots = definition.symbol.annots.filter {
17071708 case Annotation (annot, _) =>
17081709 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
17111712 case Type .NamedTypeRef (" forceInline" , Types .ScalaPackage ()) => false
17121713 case _ => true
17131714 }
@@ -1871,8 +1872,8 @@ trait Printers
18711872 def unapply (arg : Tree ) given (ctx : Context ): Option [(String , List [Term ])] = arg match {
18721873 case IsTerm (arg @ Apply (fn, args)) =>
18731874 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))
18761877 case _ => None
18771878 }
18781879 case _ => None
@@ -1893,23 +1894,23 @@ trait Printers
18931894
18941895 object JavaLangObject {
18951896 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"
18971898 case _ => false
18981899 }
18991900 }
19001901
19011902 object Sequence {
19021903 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)
19051906 case _ => None
19061907 }
19071908 }
19081909
19091910 object RepeatedAnnotation {
19101911 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"
19131914 case _ => false
19141915 }
19151916 }
@@ -1923,21 +1924,21 @@ trait Printers
19231924
19241925 object ScalaPackage {
19251926 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
19271928 case _ => false
19281929 }
19291930 }
19301931
19311932 object RootPackage {
19321933 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.==
19341935 case _ => false
19351936 }
19361937 }
19371938
19381939 object EmptyPackage {
19391940 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>"
19411942 case _ => false
19421943 }
19431944 }
0 commit comments