Skip to content

Commit b942b9e

Browse files
Merge pull request #4631 from dotty-staging/rename-tasty-extension-methods
Rename AbstractXYZ to XYZAPI in Tasty reflect
2 parents b369dcf + a4e83ed commit b942b9e

File tree

3 files changed

+69
-69
lines changed

3 files changed

+69
-69
lines changed

compiler/src/dotty/tools/dotc/tastyreflect/TastyImpl.scala

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ object TastyImpl extends scala.tasty.Tasty {
1919

2020
// ===== Quotes ===================================================
2121

22-
def QuotedExprDeco[T](x: quoted.Expr[T]): AbstractQuotedExpr = new AbstractQuotedExpr {
22+
def QuotedExprDeco[T](x: quoted.Expr[T]): QuotedExprAPI = new QuotedExprAPI {
2323
def toTasty(implicit ctx: Context): Term = PickledQuotes.quotedExprToTree(x)
2424
}
2525

26-
def QuotedTypeDeco[T](x: quoted.Type[T]): AbstractQuotedType = new AbstractQuotedType {
26+
def QuotedTypeDeco[T](x: quoted.Type[T]): QuotedTypeAPI = new QuotedTypeAPI {
2727
def toTasty(implicit ctx: Context): TypeTree = PickledQuotes.quotedTypeToTree(x)
2828
}
2929

@@ -39,15 +39,15 @@ object TastyImpl extends scala.tasty.Tasty {
3939

4040
type Context = Contexts.Context
4141

42-
def ContextDeco(ctx: Context): AbstractContext = new AbstractContext {
42+
def ContextDeco(ctx: Context): ContextAPI = new ContextAPI {
4343
def owner: Definition = FromSymbol.definition(ctx.owner)(ctx)
4444
}
4545

4646
// ===== Id =======================================================
4747

4848
type Id = untpd.Ident
4949

50-
def IdDeco(x: Id): AbstractId = new AbstractId {
50+
def IdDeco(x: Id): IdAPI = new IdAPI {
5151
def pos(implicit ctx: Context): Position = x.pos
5252
}
5353

@@ -64,7 +64,7 @@ object TastyImpl extends scala.tasty.Tasty {
6464

6565
type Tree = tpd.Tree
6666

67-
def TreeDeco(tree: Tree): AbstractTree = new AbstractTree {
67+
def TreeDeco(tree: Tree): TreeAPI = new TreeAPI {
6868
def show(implicit ctx: Context, s: Show[TastyImpl.this.type]): String = s.showTree(tree)
6969
def pos(implicit ctx: Context): Position = tree.pos
7070
}
@@ -80,7 +80,7 @@ object TastyImpl extends scala.tasty.Tasty {
8080
}
8181
}
8282

83-
def PackageClauseDeco(x: PackageClause): AbstractPackageClause = new AbstractPackageClause {
83+
def PackageClauseDeco(x: PackageClause): PackageClauseAPI = new PackageClauseAPI {
8484
def definition(implicit ctx: Context): Definition = FromSymbol.packageDef(x.symbol)
8585
}
8686

@@ -133,7 +133,7 @@ object TastyImpl extends scala.tasty.Tasty {
133133
x.isInstanceOf[Trees.MemberDef[_]]
134134
}
135135

136-
def DefinitionDeco(x: Definition): AbstractDefinition = new AbstractDefinition {
136+
def DefinitionDeco(x: Definition): DefinitionAPI = new DefinitionAPI {
137137

138138
def owner(implicit ctx: Context): Definition = FromSymbol.definition(x.symbol.owner)
139139

@@ -214,7 +214,7 @@ object TastyImpl extends scala.tasty.Tasty {
214214

215215
type PackageDef = PackageDefinition
216216

217-
def PackageDefDeco(t: PackageDef): AbstractPackageDef = new AbstractPackageDef {
217+
def PackageDefDeco(t: PackageDef): PackageDefAPI = new PackageDefAPI {
218218
def members(implicit ctx: Context): List[Statement] = {
219219
if (t.symbol.is(core.Flags.JavaDefined)) Nil // FIXME should also support java packages
220220
else t.symbol.info.decls.iterator.map(FromSymbol.definition).toList
@@ -239,7 +239,7 @@ object TastyImpl extends scala.tasty.Tasty {
239239

240240
type Term = tpd.Tree
241241

242-
def TermDeco(tree: Term): AbstractTerm = new AbstractTerm {
242+
def TermDeco(tree: Term): TermAPI = new TermAPI {
243243

244244
def pos(implicit ctx: Context): Position = tree.pos
245245

@@ -438,7 +438,7 @@ object TastyImpl extends scala.tasty.Tasty {
438438

439439
def caseDefClassTag: ClassTag[CaseDef] = implicitly[ClassTag[CaseDef]]
440440

441-
def CaseDefDeco(caseDef: CaseDef): AbstractCaseDef = new AbstractCaseDef {
441+
def CaseDefDeco(caseDef: CaseDef): CaseDefAPI = new CaseDefAPI {
442442
def show(implicit ctx: Context, s: Show[TastyImpl.this.type]): String = s.showCaseDef(caseDef)
443443
}
444444

@@ -454,7 +454,7 @@ object TastyImpl extends scala.tasty.Tasty {
454454

455455
type Pattern = tpd.Tree
456456

457-
def PatternDeco(pattern: Pattern): AbstractPattern = new AbstractPattern {
457+
def PatternDeco(pattern: Pattern): PatternAPI = new PatternAPI {
458458
def show(implicit ctx: Context, s: Show[TastyImpl.this.type]): String = s.showPattern(pattern)
459459
def pos(implicit ctx: Context): Position = pattern.pos
460460
def tpe(implicit ctx: Context): Types.Type = pattern.tpe.stripTypeVar
@@ -507,7 +507,7 @@ object TastyImpl extends scala.tasty.Tasty {
507507

508508
type TypeOrBoundsTree = tpd.Tree
509509

510-
def TypeOrBoundsTreeDeco(tpt: TypeOrBoundsTree): AbstractTypeOrBoundsTree = new AbstractTypeOrBoundsTree {
510+
def TypeOrBoundsTreeDeco(tpt: TypeOrBoundsTree): TypeOrBoundsTreeAPI = new TypeOrBoundsTreeAPI {
511511
def show(implicit ctx: Context, s: Show[TastyImpl.this.type]): String = s.showTypeOrBoundsTree(tpt)
512512
def tpe(implicit ctx: Context): Type = tpt.tpe.stripTypeVar
513513
}
@@ -516,7 +516,7 @@ object TastyImpl extends scala.tasty.Tasty {
516516

517517
type TypeTree = tpd.Tree
518518

519-
def TypeTreeDeco(x: TypeTree): AbstractTypeTree = new AbstractTypeTree {
519+
def TypeTreeDeco(x: TypeTree): TypeTreeAPI = new TypeTreeAPI {
520520
def pos(implicit ctx: Context): Position = x.pos
521521
def tpe(implicit ctx: Context): Types.Type = x.tpe.stripTypeVar
522522
}
@@ -603,7 +603,7 @@ object TastyImpl extends scala.tasty.Tasty {
603603

604604
type TypeBoundsTree = tpd.TypeBoundsTree
605605

606-
def TypeBoundsTreeDeco(x: TypeBoundsTree): AbstractTypeBoundsTree = new AbstractTypeBoundsTree {
606+
def TypeBoundsTreeDeco(x: TypeBoundsTree): TypeBoundsTreeAPI = new TypeBoundsTreeAPI {
607607
def tpe(implicit ctx: Context): TypeBounds = x.tpe.bounds
608608
}
609609

@@ -620,7 +620,7 @@ object TastyImpl extends scala.tasty.Tasty {
620620

621621
type TypeOrBounds = Types.Type
622622

623-
def TypeOrBoundsDeco(tpe: Types.Type): AbstractTypeOrBounds = new AbstractTypeOrBounds {
623+
def TypeOrBoundsDeco(tpe: Types.Type): TypeOrBoundsAPI = new TypeOrBoundsAPI {
624624
def show(implicit ctx: Context, s: Show[TastyImpl.this.type]): String = s.showTypeOrBounds(tpe)
625625
}
626626

@@ -639,7 +639,7 @@ object TastyImpl extends scala.tasty.Tasty {
639639
def polyTypeClassTag: ClassTag[PolyType] = implicitly[ClassTag[PolyType]]
640640
def typeLambdaClassTag: ClassTag[TypeLambda] = implicitly[ClassTag[TypeLambda]]
641641

642-
def MethodTypeDeco(x: MethodType): AbstractMethodType = new AbstractMethodType {
642+
def MethodTypeDeco(x: MethodType): MethodTypeAPI = new MethodTypeAPI {
643643
def isErased: Boolean = x.isErasedMethod
644644
def isImplicit: Boolean = x.isImplicitMethod
645645
}
@@ -821,7 +821,7 @@ object TastyImpl extends scala.tasty.Tasty {
821821

822822
type Constant = Constants.Constant
823823

824-
def ConstantDeco(const: Constant): AbstractConstant = new AbstractConstant {
824+
def ConstantDeco(const: Constant): ConstantAPI = new ConstantAPI {
825825
def show(implicit ctx: Context, s: Show[TastyImpl.this.type]): String = s.showConstant(const)
826826
def value: Any = const.value
827827
}
@@ -970,7 +970,7 @@ object TastyImpl extends scala.tasty.Tasty {
970970

971971
type Position = SourcePosition
972972

973-
def PositionDeco(pos: Position): AbstractPosition = new AbstractPosition {
973+
def PositionDeco(pos: Position): PositionAPI = new PositionAPI {
974974
def start = pos.start
975975
def end = pos.end
976976

library/src/scala/tasty/Tasty.scala

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ abstract class Tasty { tasty =>
77

88
// ===== Quotes ===================================================
99

10-
trait AbstractQuotedExpr {
10+
trait QuotedExprAPI {
1111
def toTasty(implicit ctx: Context): Term
1212
}
13-
implicit def QuotedExprDeco[T](x: quoted.Expr[T]): AbstractQuotedExpr
13+
implicit def QuotedExprDeco[T](x: quoted.Expr[T]): QuotedExprAPI
1414

15-
trait AbstractQuotedType {
15+
trait QuotedTypeAPI {
1616
def toTasty(implicit ctx: Context): TypeTree
1717
}
18-
implicit def QuotedTypeDeco[T](x: quoted.Type[T]): AbstractQuotedType
18+
implicit def QuotedTypeDeco[T](x: quoted.Type[T]): QuotedTypeAPI
1919

2020
// ===== Show =====================================================
2121

@@ -29,17 +29,17 @@ abstract class Tasty { tasty =>
2929

3030
type Context
3131

32-
trait AbstractContext {
32+
trait ContextAPI {
3333
def owner: Definition
3434
}
35-
implicit def ContextDeco(ctx: Context): AbstractContext
35+
implicit def ContextDeco(ctx: Context): ContextAPI
3636

3737
// ===== Id =======================================================
3838

3939
type Id
4040

41-
trait AbstractId extends Positioned
42-
implicit def IdDeco(x: Id): AbstractId
41+
trait IdAPI extends Positioned
42+
implicit def IdDeco(x: Id): IdAPI
4343

4444
implicit def idClassTag: ClassTag[Id]
4545

@@ -52,10 +52,10 @@ abstract class Tasty { tasty =>
5252

5353
type Tree
5454

55-
trait AbstractTree extends Positioned {
55+
trait TreeAPI extends Positioned {
5656
def show(implicit ctx: Context, s: Show[tasty.type]): String
5757
}
58-
implicit def TreeDeco(tree: Tree): AbstractTree
58+
implicit def TreeDeco(tree: Tree): TreeAPI
5959

6060
type PackageClause <: Tree
6161

@@ -66,10 +66,10 @@ abstract class Tasty { tasty =>
6666
def unapply(x: PackageClause)(implicit ctx: Context): Option[(Term, List[Tree])]
6767
}
6868

69-
trait AbstractPackageClause {
69+
trait PackageClauseAPI {
7070
def definition(implicit ctx: Context): Definition
7171
}
72-
implicit def PackageClauseDeco(x: PackageClause): AbstractPackageClause
72+
implicit def PackageClauseDeco(x: PackageClause): PackageClauseAPI
7373

7474
// ----- Statements -----------------------------------------------
7575

@@ -114,13 +114,13 @@ abstract class Tasty { tasty =>
114114

115115
implicit def definitionClassTag: ClassTag[Definition]
116116

117-
trait AbstractDefinition {
117+
trait DefinitionAPI {
118118
def flags(implicit ctx: Context): FlagSet
119119
def mods(implicit ctx: Context): List[Modifier]
120120
def owner(implicit ctx: Context): Definition
121121
def localContext(implicit ctx: Context): Context
122122
}
123-
implicit def DefinitionDeco(x: Definition): AbstractDefinition
123+
implicit def DefinitionDeco(x: Definition): DefinitionAPI
124124

125125
// ClassDef
126126

@@ -170,10 +170,10 @@ abstract class Tasty { tasty =>
170170

171171
type PackageDef <: Definition
172172

173-
trait AbstractPackageDef {
173+
trait PackageDefAPI {
174174
def members(implicit ctx: Context): List[Statement]
175175
}
176-
implicit def PackageDefDeco(t: PackageDef): AbstractPackageDef
176+
implicit def PackageDefDeco(t: PackageDef): PackageDefAPI
177177

178178
implicit def packageDefClassTag: ClassTag[PackageDef]
179179

@@ -190,10 +190,10 @@ abstract class Tasty { tasty =>
190190

191191
type Term <: Statement with Parent
192192

193-
trait AbstractTerm extends Typed with Positioned {
193+
trait TermAPI extends Typed with Positioned {
194194
def toExpr[T: quoted.Type](implicit ctx: Context): quoted.Expr[T]
195195
}
196-
implicit def TermDeco(t: Term): AbstractTerm
196+
implicit def TermDeco(t: Term): TermAPI
197197

198198
implicit def termClassTag: ClassTag[Term]
199199

@@ -310,10 +310,10 @@ abstract class Tasty { tasty =>
310310

311311
implicit def caseDefClassTag: ClassTag[CaseDef]
312312

313-
trait AbstractCaseDef {
313+
trait CaseDefAPI {
314314
def show(implicit ctx: Context, s: Show[tasty.type]): String
315315
}
316-
implicit def CaseDefDeco(caseDef: CaseDef): AbstractCaseDef
316+
implicit def CaseDefDeco(caseDef: CaseDef): CaseDefAPI
317317

318318
val CaseDef: CaseDefExtractor
319319
abstract class CaseDefExtractor {
@@ -324,10 +324,10 @@ abstract class Tasty { tasty =>
324324

325325
type Pattern
326326

327-
trait AbstractPattern extends Typed with Positioned {
327+
trait PatternAPI extends Typed with Positioned {
328328
def show(implicit ctx: Context, s: Show[tasty.type]): String
329329
}
330-
implicit def PatternDeco(x: Pattern): AbstractPattern
330+
implicit def PatternDeco(x: Pattern): PatternAPI
331331

332332
implicit def patternClassTag: ClassTag[Pattern]
333333

@@ -365,19 +365,19 @@ abstract class Tasty { tasty =>
365365

366366
type TypeOrBoundsTree
367367

368-
trait AbstractTypeOrBoundsTree {
368+
trait TypeOrBoundsTreeAPI {
369369
def show(implicit ctx: Context, s: Show[tasty.type]): String
370370
def tpe(implicit ctx: Context): TypeOrBounds
371371
}
372-
implicit def TypeOrBoundsTreeDeco(tpt: TypeOrBoundsTree): AbstractTypeOrBoundsTree
372+
implicit def TypeOrBoundsTreeDeco(tpt: TypeOrBoundsTree): TypeOrBoundsTreeAPI
373373

374374

375375
// ----- TypeTrees ------------------------------------------------
376376

377377
type TypeTree <: TypeOrBoundsTree with Parent
378378

379-
trait AbstractTypeTree extends Typed with Positioned
380-
implicit def TypeTreeDeco(x: TypeTree): AbstractTypeTree
379+
trait TypeTreeAPI extends Typed with Positioned
380+
implicit def TypeTreeDeco(x: TypeTree): TypeTreeAPI
381381

382382
implicit def typeTreeClassTag: ClassTag[TypeTree]
383383

@@ -442,10 +442,10 @@ abstract class Tasty { tasty =>
442442

443443
type TypeBoundsTree <: TypeOrBoundsTree
444444

445-
trait AbstractTypeBoundsTree {
445+
trait TypeBoundsTreeAPI {
446446
def tpe(implicit ctx: Context): TypeBounds
447447
}
448-
implicit def TypeBoundsTreeDeco(x: TypeBoundsTree): AbstractTypeBoundsTree
448+
implicit def TypeBoundsTreeDeco(x: TypeBoundsTree): TypeBoundsTreeAPI
449449

450450
implicit def typeBoundsTreeClassTag: ClassTag[TypeBoundsTree]
451451

@@ -462,10 +462,10 @@ abstract class Tasty { tasty =>
462462
def tpe(implicit ctx: Context): Type
463463
}
464464

465-
trait AbstractTypeOrBounds {
465+
trait TypeOrBoundsAPI {
466466
def show(implicit ctx: Context, s: Show[tasty.type]): String
467467
}
468-
implicit def TypeOrBoundsDeco(tpe: TypeOrBounds): AbstractTypeOrBounds
468+
implicit def TypeOrBoundsDeco(tpe: TypeOrBounds): TypeOrBoundsAPI
469469

470470
// ----- Types ----------------------------------------------------
471471

@@ -484,11 +484,11 @@ abstract class Tasty { tasty =>
484484
implicit def typeLambdaClassTag: ClassTag[TypeLambda]
485485
implicit def recursiveTypeClassTag: ClassTag[RecursiveType]
486486

487-
trait AbstractMethodType {
487+
trait MethodTypeAPI {
488488
def isImplicit: Boolean
489489
def isErased: Boolean
490490
}
491-
implicit def MethodTypeDeco(x: MethodType): AbstractMethodType
491+
implicit def MethodTypeDeco(x: MethodType): MethodTypeAPI
492492

493493
val Type: TypeModule
494494
abstract class TypeModule {
@@ -612,11 +612,11 @@ abstract class Tasty { tasty =>
612612
// ===== Constants ================================================
613613

614614
type Constant
615-
trait AbstractConstant {
615+
trait ConstantAPI {
616616
def show(implicit ctx: Context, s: Show[tasty.type]): String
617617
def value: Any
618618
}
619-
implicit def ConstantDeco(const: Constant): AbstractConstant
619+
implicit def ConstantDeco(const: Constant): ConstantAPI
620620

621621
implicit def constantClassTag: ClassTag[Constant]
622622

@@ -727,7 +727,7 @@ abstract class Tasty { tasty =>
727727

728728
type Position
729729

730-
trait AbstractPosition {
730+
trait PositionAPI {
731731
def start: Int
732732
def end: Int
733733

@@ -738,7 +738,7 @@ abstract class Tasty { tasty =>
738738
def endLine: Int
739739
def endColumn: Int
740740
}
741-
implicit def PositionDeco(pos: Position): AbstractPosition
741+
implicit def PositionDeco(pos: Position): PositionAPI
742742

743743
trait Positioned {
744744
def pos(implicit ctx: Context): Position

0 commit comments

Comments
 (0)