@@ -356,7 +356,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
356356 this += " throw "
357357 printTree(expr)
358358
359- case Apply (fn, args) if fn.symbol.fullName == " scala.internal.Quoted$ .exprQuote" =>
359+ case Apply (fn, args) if fn.symbol == ctx.requiredMethod( " scala.internal.Quoted.exprQuote" ) =>
360360 args.head match {
361361 case Block (stats, expr) =>
362362 this += " '{"
@@ -371,12 +371,12 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
371371 this += " }"
372372 }
373373
374- case TypeApply (fn, args) if fn.symbol.fullName == " scala.internal.Quoted$ .typeQuote" =>
374+ case TypeApply (fn, args) if fn.symbol == ctx.requiredMethod( " scala.internal.Quoted.typeQuote" ) =>
375375 this += " '["
376376 printTypeTree(args.head)
377377 this += " ]"
378378
379- case Apply (fn, arg :: Nil ) if fn.symbol.fullName == " scala.internal.Quoted$ .exprSplice" =>
379+ case Apply (fn, arg :: Nil ) if fn.symbol == ctx.requiredMethod( " scala.internal.Quoted.exprSplice" ) =>
380380 this += " ${"
381381 printTree(arg)
382382 this += " }"
@@ -573,7 +573,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
573573 def printFlatBlock (stats : List [Statement ], expr : Term )(given elideThis : Option [Symbol ]): Buffer = {
574574 val (stats1, expr1) = flatBlock(stats, expr)
575575 val stats2 = stats1.filter {
576- case tree : TypeDef => ! tree.symbol.annots.exists(_.symbol.owner.fullName == " scala.internal.Quoted$ .quoteTypeTag" )
576+ case tree : TypeDef => ! tree.symbol.annots.exists(_.symbol.owner == ctx.requiredClass( " scala.internal.Quoted.quoteTypeTag" ) )
577577 case _ => true
578578 }
579579 if (stats2.isEmpty) {
@@ -971,7 +971,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
971971 printTypeAndAnnots(tp)
972972 this += " "
973973 printAnnotation(annot)
974- case tpe : TypeRef if tpe.typeSymbol.fullName == " scala.runtime.Null$" || tpe.typeSymbol.fullName == " scala.runtime.Nothing$" =>
974+ case tpe : TypeRef if tpe.typeSymbol == ctx.requiredClass( " scala.runtime.Null$" ) || tpe.typeSymbol == ctx.requiredClass( " scala.runtime.Nothing$" ) =>
975975 // scala.runtime.Null$ and scala.runtime.Nothing$ are not modules, those are their actual names
976976 printType(tpe)
977977 case tpe : TermRef if tpe.termSymbol.isClassDef && tpe.termSymbol.name.endsWith(" $" ) =>
@@ -1228,7 +1228,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
12281228
12291229 def printAnnotation (annot : Term )(given elideThis : Option [Symbol ]): Buffer = {
12301230 val Annotation (ref, args) = annot
1231- if (annot.symbol.maybeOwner.fullName == " scala.internal.quoted.showName" ) this
1231+ if (annot.symbol.maybeOwner == ctx.requiredClass( " scala.internal.quoted.showName" ) ) this
12321232 else {
12331233 this += " @"
12341234 printTypeTree(ref)
@@ -1243,8 +1243,8 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
12431243 val annots = definition.symbol.annots.filter {
12441244 case Annotation (annot, _) =>
12451245 annot.tpe match {
1246- case TypeRef (prefix : TermRef , _) if prefix.termSymbol.fullName == " scala.annotation.internal" => false
1247- case TypeRef (prefix : TypeRef , _) if prefix.typeSymbol.fullName == " scala.annotation.internal" => false
1246+ case TypeRef (prefix : TermRef , _) if prefix.termSymbol == ctx.requiredPackage( " scala.annotation.internal" ) => false
1247+ case TypeRef (prefix : TypeRef , _) if prefix.typeSymbol == ctx.requiredPackage( " scala.annotation.internal" ) => false
12481248 case TypeRef (Types .ScalaPackage (), " forceInline" ) => false
12491249 case _ => true
12501250 }
@@ -1404,7 +1404,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
14041404 }
14051405
14061406 private def splicedName (sym : Symbol )(given ctx : Context ): Option [String ] = {
1407- sym.annots.find(_.symbol.owner.fullName == " scala.internal.quoted.showName" ).flatMap {
1407+ sym.annots.find(_.symbol.owner == ctx.requiredClass( " scala.internal.quoted.showName" ) ).flatMap {
14081408 case Apply (_, Literal (Constant (c : String )) :: Nil ) => Some (c)
14091409 case Apply (_, Inlined (_, _, Literal (Constant (c : String ))) :: Nil ) => Some (c)
14101410 case annot => None
@@ -1437,23 +1437,23 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
14371437
14381438 object JavaLangObject {
14391439 def unapply (tpe : Type )(given ctx : Context ): Boolean = tpe match {
1440- case TypeRef (prefix : TermRef , " Object" ) => prefix.typeSymbol.fullName == " java.lang"
1440+ case TypeRef (prefix : TermRef , " Object" ) => prefix.typeSymbol == ctx.requiredPackage( " java.lang" )
14411441 case _ => false
14421442 }
14431443 }
14441444
14451445 object Sequence {
14461446 def unapply (tpe : Type )(given ctx : Context ): Option [Type ] = tpe match {
1447- case AppliedType (TypeRef (prefix : TermRef , " Seq" ), (tp : Type ) :: Nil ) if prefix.termSymbol.fullName == " scala.collection" => Some (tp)
1448- case AppliedType (TypeRef (prefix : TypeRef , " Seq" ), (tp : Type ) :: Nil ) if prefix.typeSymbol.fullName == " scala.collection" => Some (tp)
1447+ case AppliedType (TypeRef (prefix : TermRef , " Seq" ), (tp : Type ) :: Nil ) if prefix.termSymbol == ctx.requiredPackage( " scala.collection" ) => Some (tp)
1448+ case AppliedType (TypeRef (prefix : TypeRef , " Seq" ), (tp : Type ) :: Nil ) if prefix.typeSymbol == ctx.requiredPackage( " scala.collection" ) => Some (tp)
14491449 case _ => None
14501450 }
14511451 }
14521452
14531453 object RepeatedAnnotation {
14541454 def unapply (tpe : Type )(given ctx : Context ): Boolean = tpe match {
1455- case TypeRef (prefix : TermRef , " Repeated" ) => prefix.termSymbol.fullName == " scala.annotation.internal"
1456- case TypeRef (prefix : TypeRef , " Repeated" ) => prefix.typeSymbol.fullName == " scala.annotation.internal"
1455+ case TypeRef (prefix : TermRef , " Repeated" ) => prefix.termSymbol == ctx.requiredPackage( " scala.annotation.internal" )
1456+ case TypeRef (prefix : TypeRef , " Repeated" ) => prefix.typeSymbol == ctx.requiredPackage( " scala.annotation.internal" )
14571457 case _ => false
14581458 }
14591459 }
0 commit comments