@@ -356,7 +356,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
356
356
this += " throw "
357
357
printTree(expr)
358
358
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" ) =>
360
360
args.head match {
361
361
case Block (stats, expr) =>
362
362
this += " '{"
@@ -371,12 +371,12 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
371
371
this += " }"
372
372
}
373
373
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" ) =>
375
375
this += " '["
376
376
printTypeTree(args.head)
377
377
this += " ]"
378
378
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" ) =>
380
380
this += " ${"
381
381
printTree(arg)
382
382
this += " }"
@@ -573,7 +573,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
573
573
def printFlatBlock (stats : List [Statement ], expr : Term )(given elideThis : Option [Symbol ]): Buffer = {
574
574
val (stats1, expr1) = flatBlock(stats, expr)
575
575
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" ) )
577
577
case _ => true
578
578
}
579
579
if (stats2.isEmpty) {
@@ -971,7 +971,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
971
971
printTypeAndAnnots(tp)
972
972
this += " "
973
973
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$" ) =>
975
975
// scala.runtime.Null$ and scala.runtime.Nothing$ are not modules, those are their actual names
976
976
printType(tpe)
977
977
case tpe : TermRef if tpe.termSymbol.isClassDef && tpe.termSymbol.name.endsWith(" $" ) =>
@@ -1228,7 +1228,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
1228
1228
1229
1229
def printAnnotation (annot : Term )(given elideThis : Option [Symbol ]): Buffer = {
1230
1230
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
1232
1232
else {
1233
1233
this += " @"
1234
1234
printTypeTree(ref)
@@ -1243,8 +1243,8 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
1243
1243
val annots = definition.symbol.annots.filter {
1244
1244
case Annotation (annot, _) =>
1245
1245
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
1248
1248
case TypeRef (Types .ScalaPackage (), " forceInline" ) => false
1249
1249
case _ => true
1250
1250
}
@@ -1404,7 +1404,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
1404
1404
}
1405
1405
1406
1406
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 {
1408
1408
case Apply (_, Literal (Constant (c : String )) :: Nil ) => Some (c)
1409
1409
case Apply (_, Inlined (_, _, Literal (Constant (c : String ))) :: Nil ) => Some (c)
1410
1410
case annot => None
@@ -1437,23 +1437,23 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
1437
1437
1438
1438
object JavaLangObject {
1439
1439
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" )
1441
1441
case _ => false
1442
1442
}
1443
1443
}
1444
1444
1445
1445
object Sequence {
1446
1446
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)
1449
1449
case _ => None
1450
1450
}
1451
1451
}
1452
1452
1453
1453
object RepeatedAnnotation {
1454
1454
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" )
1457
1457
case _ => false
1458
1458
}
1459
1459
}
0 commit comments