Skip to content

Commit 4705df2

Browse files
Merge pull request #6191 from dotty-staging/disambiguate-ident-and-select
Remove ambiguities from TASTy reflect interface
2 parents 2a2de2d + dc7c97f commit 4705df2

File tree

15 files changed

+346
-346
lines changed

15 files changed

+346
-346
lines changed

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

Lines changed: 70 additions & 70 deletions
Large diffs are not rendered by default.

docs/docs/reference/other-new-features/tasty-reflect.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ TASTy Reflect provides the following types:
116116
| +- SelectOuter
117117
| +- While
118118
|
119-
+- TypeTree ----+- Synthetic
120-
| +- Ident
121-
| +- Select
119+
+- TypeTree ----+- Inferred
120+
| +- TypeIdent
121+
| +- TypeSelect
122122
| +- Project
123123
| +- Singleton
124124
| +- Refined
125125
| +- Applied
126126
| +- Annotated
127-
| +- MatchType
127+
| +- MatchTypeTree
128128
| +- ByName
129129
| +- LambdaTypeTree
130130
| +- Bind

library/src/scala/tasty/reflect/Core.scala

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ package scala.tasty.reflect
3939
* |
4040
* |
4141
* +- TypeTree ----+- Inferred
42-
* | +- Ident
43-
* | +- Select
42+
* | +- TypeIdent
43+
* | +- TypeSelect
4444
* | +- Project
4545
* | +- Singleton
4646
* | +- Refined
4747
* | +- Applied
4848
* | +- Annotated
49-
* | +- MatchType
49+
* | +- MatchTypeTree
5050
* | +- ByName
5151
* | +- LambdaTypeTree
5252
* | +- TypeBind
@@ -247,43 +247,43 @@ trait Core {
247247
trait TypeTreeCoreModule {
248248

249249
/** Type tree representing an inferred type */
250-
type Inferred = kernel.TypeTree_Inferred
250+
type Inferred = kernel.Inferred
251251

252252
/** Type tree representing a reference to definition with a given name */
253-
type Ident = kernel.TypeTree_Ident
253+
type TypeIdent = kernel.TypeIdent
254254

255255
/** Type tree representing a selection of definition with a given name on a given term prefix */
256-
type Select = kernel.TypeTree_Select
256+
type TypeSelect = kernel.TypeSelect
257257

258258
/** Type tree representing a selection of definition with a given name on a given type prefix */
259-
type Projection = kernel.TypeTree_Projection
259+
type Projection = kernel.Projection
260260

261261
/** Type tree representing a singleton type */
262-
type Singleton = kernel.TypeTree_Singleton
262+
type Singleton = kernel.Singleton
263263

264264
/** Type tree representing a type refinement */
265-
type Refined = kernel.TypeTree_Refined
265+
type Refined = kernel.Refined
266266

267267
/** Type tree representing a type application */
268-
type Applied = kernel.TypeTree_Applied
268+
type Applied = kernel.Applied
269269

270270
/** Type tree representing an annotated type */
271-
type Annotated = kernel.TypeTree_Annotated
271+
type Annotated = kernel.Annotated
272272

273273
/** Type tree representing a type match */
274-
type MatchType = kernel.TypeTree_MatchType
274+
type MatchTypeTree = kernel.MatchTypeTree
275275

276276
/** Type tree representing a by name parameter */
277-
type ByName = kernel.TypeTree_ByName
277+
type ByName = kernel.ByName
278278

279279
/** Type tree representing a lambda abstraction type */
280-
type LambdaTypeTree = kernel.TypeTree_LambdaTypeTree
280+
type LambdaTypeTree = kernel.LambdaTypeTree
281281

282282
/** Type tree representing a type binding */
283-
type TypeBind = kernel.TypeTree_TypeBind
283+
type TypeBind = kernel.TypeBind
284284

285285
/** Type tree within a block with aliases `{ type U1 = ... ; T[U1, U2] }` */
286-
type TypeBlock = kernel.TypeTree_TypeBlock
286+
type TypeBlock = kernel.TypeBlock
287287

288288
}
289289

library/src/scala/tasty/reflect/Kernel.scala

Lines changed: 83 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,19 @@ package scala.tasty.reflect
3737
* | +- While
3838
* |
3939
* |
40-
* +- TypeTree ----+- TypeTree_Inferred
41-
* | +- TypeTree_Ident
42-
* | +- TypeTree_Select
43-
* | +- TypeTree_Project
44-
* | +- TypeTree_Singleton
45-
* | +- TypeTree_Refined
46-
* | +- TypeTree_Applied
47-
* | +- TypeTree_Annotated
48-
* | +- TypeTree_MatchType
49-
* | +- TypeTree_ByName
50-
* | +- TypeTree_LambdaTypeTree
51-
* | +- TypeTree_TypeBind
52-
* | +- TypeTree_TypeBlock
40+
* +- TypeTree ----+- Inferred
41+
* | +- TypeIdent
42+
* | +- TypeSelect
43+
* | +- Project
44+
* | +- Singleton
45+
* | +- Refined
46+
* | +- Applied
47+
* | +- Annotated
48+
* | +- MatchTypeTree
49+
* | +- ByName
50+
* | +- LambdaTypeTree
51+
* | +- TypeBind
52+
* | +- TypeBlock
5353
* |
5454
* +- TypeBoundsTree
5555
* +- WildcardTypeTree
@@ -550,137 +550,137 @@ trait Kernel {
550550
def TypeTree_tpe(self: TypeTree)(implicit ctx: Context): Type
551551

552552
/** Type tree representing an inferred type */
553-
type TypeTree_Inferred <: TypeTree
553+
type Inferred <: TypeTree
554554

555-
def matchTypeTree_Inferred(tree: Tree)(implicit ctx: Context): Option[TypeTree_Inferred]
555+
def matchInferred(tree: Tree)(implicit ctx: Context): Option[Inferred]
556556

557-
def TypeTree_Inferred_apply(tpe: Type)(implicit ctx: Context): TypeTree_Inferred
557+
def Inferred_apply(tpe: Type)(implicit ctx: Context): Inferred
558558

559559
/** Type tree representing a reference to definition with a given name */
560-
type TypeTree_Ident <: TypeTree
560+
type TypeIdent <: TypeTree
561561

562-
def matchTypeTree_Ident(tree: Tree)(implicit ctx: Context): Option[TypeTree_Ident]
562+
def matchTypeIdent(tree: Tree)(implicit ctx: Context): Option[TypeIdent]
563563

564-
def TypeTree_Ident_name(self: TypeTree_Ident)(implicit ctx: Context): String
564+
def TypeIdent_name(self: TypeIdent)(implicit ctx: Context): String
565565

566-
def TypeTree_Ident_copy(original: TypeTree_Ident)(name: String)(implicit ctx: Context): TypeTree_Ident
566+
def TypeIdent_copy(original: TypeIdent)(name: String)(implicit ctx: Context): TypeIdent
567567

568568
/** Type tree representing a selection of definition with a given name on a given term prefix */
569-
type TypeTree_Select <: TypeTree
569+
type TypeSelect <: TypeTree
570570

571-
def matchTypeTree_Select(tree: Tree)(implicit ctx: Context): Option[TypeTree_Select]
571+
def matchTypeSelect(tree: Tree)(implicit ctx: Context): Option[TypeSelect]
572572

573-
def TypeTree_Select_qualifier(self: TypeTree_Select)(implicit ctx: Context): Term
574-
def TypeTree_Select_name(self: TypeTree_Select)(implicit ctx: Context): String
573+
def TypeSelect_qualifier(self: TypeSelect)(implicit ctx: Context): Term
574+
def TypeSelect_name(self: TypeSelect)(implicit ctx: Context): String
575575

576-
def TypeTree_Select_apply(qualifier: Term, name: String)(implicit ctx: Context): TypeTree_Select
577-
def TypeTree_Select_copy(original: TypeTree_Select)(qualifier: Term, name: String)(implicit ctx: Context): TypeTree_Select
576+
def TypeSelect_apply(qualifier: Term, name: String)(implicit ctx: Context): TypeSelect
577+
def TypeSelect_copy(original: TypeSelect)(qualifier: Term, name: String)(implicit ctx: Context): TypeSelect
578578

579579
/** Type tree representing a selection of definition with a given name on a given type prefix */
580-
type TypeTree_Projection <: TypeTree
580+
type Projection <: TypeTree
581581

582-
def matchTypeTree_Projection(tree: Tree)(implicit ctx: Context): Option[TypeTree_Projection]
582+
def matchProjection(tree: Tree)(implicit ctx: Context): Option[Projection]
583583

584-
def TypeTree_Projection_qualifier(self: TypeTree_Projection)(implicit ctx: Context): TypeTree
585-
def TypeTree_Projection_name(self: TypeTree_Projection)(implicit ctx: Context): String
584+
def Projection_qualifier(self: Projection)(implicit ctx: Context): TypeTree
585+
def Projection_name(self: Projection)(implicit ctx: Context): String
586586

587-
def TypeTree_Projection_copy(original: TypeTree_Projection)(qualifier: TypeTree, name: String)(implicit ctx: Context): TypeTree_Projection
587+
def Projection_copy(original: Projection)(qualifier: TypeTree, name: String)(implicit ctx: Context): Projection
588588

589589
/** Type tree representing a singleton type */
590-
type TypeTree_Singleton <: TypeTree
590+
type Singleton <: TypeTree
591591

592-
def matchTypeTree_Singleton(tree: Tree)(implicit ctx: Context): Option[TypeTree_Singleton]
592+
def matchSingleton(tree: Tree)(implicit ctx: Context): Option[Singleton]
593593

594-
def TypeTree_Singleton_ref(self: TypeTree_Singleton)(implicit ctx: Context): Term
594+
def Singleton_ref(self: Singleton)(implicit ctx: Context): Term
595595

596-
def TypeTree_Singleton_apply(ref: Term)(implicit ctx: Context): TypeTree_Singleton
597-
def TypeTree_Singleton_copy(original: TypeTree_Singleton)(ref: Term)(implicit ctx: Context): TypeTree_Singleton
596+
def Singleton_apply(ref: Term)(implicit ctx: Context): Singleton
597+
def Singleton_copy(original: Singleton)(ref: Term)(implicit ctx: Context): Singleton
598598

599599
/** Type tree representing a type refinement */
600-
type TypeTree_Refined <: TypeTree
600+
type Refined <: TypeTree
601601

602-
def matchTypeTree_Refined(tree: Tree)(implicit ctx: Context): Option[TypeTree_Refined]
602+
def matchRefined(tree: Tree)(implicit ctx: Context): Option[Refined]
603603

604-
def TypeTree_Refined_tpt(self: TypeTree_Refined)(implicit ctx: Context): TypeTree
605-
def TypeTree_Refined_refinements(self: TypeTree_Refined)(implicit ctx: Context): List[Definition]
604+
def Refined_tpt(self: Refined)(implicit ctx: Context): TypeTree
605+
def Refined_refinements(self: Refined)(implicit ctx: Context): List[Definition]
606606

607-
def TypeTree_Refined_copy(original: TypeTree_Refined)(tpt: TypeTree, refinements: List[Definition])(implicit ctx: Context): TypeTree_Refined
607+
def Refined_copy(original: Refined)(tpt: TypeTree, refinements: List[Definition])(implicit ctx: Context): Refined
608608

609609
/** Type tree representing a type application */
610-
type TypeTree_Applied <: TypeTree
610+
type Applied <: TypeTree
611611

612-
def matchTypeTree_Applied(tree: Tree)(implicit ctx: Context): Option[TypeTree_Applied]
612+
def matchApplied(tree: Tree)(implicit ctx: Context): Option[Applied]
613613

614-
def TypeTree_Applied_tpt(self: TypeTree_Applied)(implicit ctx: Context): TypeTree
615-
def TypeTree_Applied_args(self: TypeTree_Applied)(implicit ctx: Context): List[Tree /*TypeTree | TypeBoundsTree*/]
614+
def Applied_tpt(self: Applied)(implicit ctx: Context): TypeTree
615+
def Applied_args(self: Applied)(implicit ctx: Context): List[Tree /*TypeTree | TypeBoundsTree*/]
616616

617-
def TypeTree_Applied_apply(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/])(implicit ctx: Context): TypeTree_Applied
618-
def TypeTree_Applied_copy(original: TypeTree_Applied)(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/])(implicit ctx: Context): TypeTree_Applied
617+
def Applied_apply(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/])(implicit ctx: Context): Applied
618+
def Applied_copy(original: Applied)(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/])(implicit ctx: Context): Applied
619619

620620
/** Type tree representing an annotated type */
621-
type TypeTree_Annotated <: TypeTree
621+
type Annotated <: TypeTree
622622

623-
def matchTypeTree_Annotated(tree: Tree)(implicit ctx: Context): Option[TypeTree_Annotated]
623+
def matchAnnotated(tree: Tree)(implicit ctx: Context): Option[Annotated]
624624

625-
def TypeTree_Annotated_arg(self: TypeTree_Annotated)(implicit ctx: Context): TypeTree
626-
def TypeTree_Annotated_annotation(self: TypeTree_Annotated)(implicit ctx: Context): Term
625+
def Annotated_arg(self: Annotated)(implicit ctx: Context): TypeTree
626+
def Annotated_annotation(self: Annotated)(implicit ctx: Context): Term
627627

628-
def TypeTree_Annotated_apply(arg: TypeTree, annotation: Term)(implicit ctx: Context): TypeTree_Annotated
629-
def TypeTree_Annotated_copy(original: TypeTree_Annotated)(arg: TypeTree, annotation: Term)(implicit ctx: Context): TypeTree_Annotated
628+
def Annotated_apply(arg: TypeTree, annotation: Term)(implicit ctx: Context): Annotated
629+
def Annotated_copy(original: Annotated)(arg: TypeTree, annotation: Term)(implicit ctx: Context): Annotated
630630

631631
/** Type tree representing a type match */
632-
type TypeTree_MatchType <: TypeTree
632+
type MatchTypeTree <: TypeTree
633633

634-
def matchTypeTree_MatchType(tree: Tree)(implicit ctx: Context): Option[TypeTree_MatchType]
634+
def matchMatchTypeTree(tree: Tree)(implicit ctx: Context): Option[MatchTypeTree]
635635

636-
def TypeTree_MatchType_bound(self: TypeTree_MatchType)(implicit ctx: Context): Option[TypeTree]
637-
def TypeTree_MatchType_selector(self: TypeTree_MatchType)(implicit ctx: Context): TypeTree
638-
def TypeTree_MatchType_cases(self: TypeTree_MatchType)(implicit ctx: Context): List[TypeCaseDef]
636+
def MatchTypeTree_bound(self: MatchTypeTree)(implicit ctx: Context): Option[TypeTree]
637+
def MatchTypeTree_selector(self: MatchTypeTree)(implicit ctx: Context): TypeTree
638+
def MatchTypeTree_cases(self: MatchTypeTree)(implicit ctx: Context): List[TypeCaseDef]
639639

640-
def TypeTree_MatchType_apply(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(implicit ctx: Context): TypeTree_MatchType
641-
def TypeTree_MatchType_copy(original: TypeTree_MatchType)(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(implicit ctx: Context): TypeTree_MatchType
640+
def MatchTypeTree_apply(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(implicit ctx: Context): MatchTypeTree
641+
def MatchTypeTree_copy(original: MatchTypeTree)(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(implicit ctx: Context): MatchTypeTree
642642

643643
/** Type tree representing a by name parameter */
644-
type TypeTree_ByName <: TypeTree
644+
type ByName <: TypeTree
645645

646-
def TypeTree_ByName_result(self: TypeTree_ByName)(implicit ctx: Context): TypeTree
646+
def ByName_result(self: ByName)(implicit ctx: Context): TypeTree
647647

648-
def matchTypeTree_ByName(tree: Tree)(implicit ctx: Context): Option[TypeTree_ByName]
648+
def matchByName(tree: Tree)(implicit ctx: Context): Option[ByName]
649649

650-
def TypeTree_ByName_apply(result: TypeTree)(implicit ctx: Context): TypeTree_ByName
651-
def TypeTree_ByName_copy(original: TypeTree_ByName)(result: TypeTree)(implicit ctx: Context): TypeTree_ByName
650+
def ByName_apply(result: TypeTree)(implicit ctx: Context): ByName
651+
def ByName_copy(original: ByName)(result: TypeTree)(implicit ctx: Context): ByName
652652

653653
/** Type tree representing a lambda abstraction type */
654-
type TypeTree_LambdaTypeTree <: TypeTree
654+
type LambdaTypeTree <: TypeTree
655655

656-
def matchTypeTree_LambdaTypeTree(tree: Tree)(implicit ctx: Context): Option[TypeTree_LambdaTypeTree]
656+
def matchLambdaTypeTree(tree: Tree)(implicit ctx: Context): Option[LambdaTypeTree]
657657

658-
def TypeTree_LambdaTypeTree_tparams(self: TypeTree_LambdaTypeTree)(implicit ctx: Context): List[TypeDef]
659-
def TypeTree_LambdaTypeTree_body(self: TypeTree_LambdaTypeTree)(implicit ctx: Context): Tree /*TypeTree | TypeBoundsTree*/
658+
def Lambdatparams(self: LambdaTypeTree)(implicit ctx: Context): List[TypeDef]
659+
def Lambdabody(self: LambdaTypeTree)(implicit ctx: Context): Tree /*TypeTree | TypeBoundsTree*/
660660

661-
def TypeTree_LambdaTypeTree_apply(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/)(implicit ctx: Context): TypeTree_LambdaTypeTree
662-
def TypeTree_LambdaTypeTree_copy(original: TypeTree_LambdaTypeTree)(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/)(implicit ctx: Context): TypeTree_LambdaTypeTree
661+
def Lambdaapply(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/)(implicit ctx: Context): LambdaTypeTree
662+
def Lambdacopy(original: LambdaTypeTree)(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/)(implicit ctx: Context): LambdaTypeTree
663663

664664
/** Type tree representing a type binding */
665-
type TypeTree_TypeBind <: TypeTree
665+
type TypeBind <: TypeTree
666666

667-
def matchTypeTree_TypeBind(tree: Tree)(implicit ctx: Context): Option[TypeTree_TypeBind]
667+
def matchTypeBind(tree: Tree)(implicit ctx: Context): Option[TypeBind]
668668

669-
def TypeTree_TypeBind_name(self: TypeTree_TypeBind)(implicit ctx: Context): String
670-
def TypeTree_TypeBind_body(self: TypeTree_TypeBind)(implicit ctx: Context): Tree /*TypeTree | TypeBoundsTree*/
669+
def TypeBind_name(self: TypeBind)(implicit ctx: Context): String
670+
def TypeBind_body(self: TypeBind)(implicit ctx: Context): Tree /*TypeTree | TypeBoundsTree*/
671671

672-
def TypeTree_TypeBind_copy(original: TypeTree_TypeBind)(name: String, tpt: Tree /*TypeTree | TypeBoundsTree*/)(implicit ctx: Context): TypeTree_TypeBind
672+
def TypeBind_copy(original: TypeBind)(name: String, tpt: Tree /*TypeTree | TypeBoundsTree*/)(implicit ctx: Context): TypeBind
673673

674674
/** Type tree within a block with aliases `{ type U1 = ... ; T[U1, U2] }` */
675-
type TypeTree_TypeBlock <: TypeTree
675+
type TypeBlock <: TypeTree
676676

677-
def matchTypeTree_TypeBlock(tree: Tree)(implicit ctx: Context): Option[TypeTree_TypeBlock]
677+
def matchTypeBlock(tree: Tree)(implicit ctx: Context): Option[TypeBlock]
678678

679-
def TypeTree_TypeBlock_aliases(self: TypeTree_TypeBlock)(implicit ctx: Context): List[TypeDef]
680-
def TypeTree_TypeBlock_tpt(self: TypeTree_TypeBlock)(implicit ctx: Context): TypeTree
679+
def TypeBlock_aliases(self: TypeBlock)(implicit ctx: Context): List[TypeDef]
680+
def TypeBlock_tpt(self: TypeBlock)(implicit ctx: Context): TypeTree
681681

682-
def TypeTree_TypeBlock_apply(aliases: List[TypeDef], tpt: TypeTree)(implicit ctx: Context): TypeTree_TypeBlock
683-
def TypeTree_TypeBlock_copy(original: TypeTree_TypeBlock)(aliases: List[TypeDef], tpt: TypeTree)(implicit ctx: Context): TypeTree_TypeBlock
682+
def TypeBlock_apply(aliases: List[TypeDef], tpt: TypeTree)(implicit ctx: Context): TypeBlock
683+
def TypeBlock_copy(original: TypeBlock)(aliases: List[TypeDef], tpt: TypeTree)(implicit ctx: Context): TypeBlock
684684

685685
/** Type tree representing a type bound written in the source */
686686
type TypeBoundsTree <: Tree /*TypeTree | TypeBoundsTree*/
@@ -1277,7 +1277,7 @@ trait Kernel {
12771277
def matchTypeBindSymbol(symbol: Symbol)(implicit ctx: Context): Option[TypeBindSymbol]
12781278

12791279
/** TypeBind pattern of this definition */
1280-
def TypeBindSymbol_tree(self: TypeBindSymbol)(implicit ctx: Context): TypeTree_TypeBind
1280+
def TypeBindSymbol_tree(self: TypeBindSymbol)(implicit ctx: Context): TypeBind
12811281

12821282
type TermSymbol <: Symbol
12831283

0 commit comments

Comments
 (0)