Skip to content

Commit 43f72c2

Browse files
Merge pull request #10418 from dotty-staging/renmae-porjection
Rename reflection Projection to TypeProjection
2 parents 94982dd + 8c0f224 commit 43f72c2

File tree

4 files changed

+29
-29
lines changed

4 files changed

+29
-29
lines changed

compiler/src/scala/quoted/internal/impl/QuoteContextImpl.scala

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,27 +1056,27 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl
10561056
end extension
10571057
end TypeSelectMethodsImpl
10581058

1059-
type Projection = tpd.Select
1059+
type TypeProjection = tpd.Select
10601060

1061-
object ProjectionTypeTest extends TypeTest[Tree, Projection]:
1062-
def unapply(x: Tree): Option[Projection & x.type] = x match
1061+
object TypeProjectionTypeTest extends TypeTest[Tree, TypeProjection]:
1062+
def unapply(x: Tree): Option[TypeProjection & x.type] = x match
10631063
case tpt: (tpd.Select & x.type) if tpt.isType && tpt.qualifier.isType => Some(tpt)
10641064
case _ => None
1065-
end ProjectionTypeTest
1065+
end TypeProjectionTypeTest
10661066

1067-
object Projection extends ProjectionModule:
1068-
def copy(original: Tree)(qualifier: TypeTree, name: String): Projection =
1067+
object TypeProjection extends TypeProjectionModule:
1068+
def copy(original: Tree)(qualifier: TypeTree, name: String): TypeProjection =
10691069
tpd.cpy.Select(original)(qualifier, name.toTypeName)
1070-
def unapply(x: Projection): Option[(TypeTree, String)] =
1070+
def unapply(x: TypeProjection): Option[(TypeTree, String)] =
10711071
Some((x.qualifier, x.name.toString))
1072-
end Projection
1072+
end TypeProjection
10731073

1074-
object ProjectionMethodsImpl extends ProjectionMethods:
1075-
extension (self: Projection):
1074+
object TypeProjectionMethodsImpl extends TypeProjectionMethods:
1075+
extension (self: TypeProjection):
10761076
def qualifier: TypeTree = self.qualifier
10771077
def name: String = self.name.toString
10781078
end extension
1079-
end ProjectionMethodsImpl
1079+
end TypeProjectionMethodsImpl
10801080

10811081
type Singleton = tpd.SingletonTypeTree
10821082

compiler/src/scala/quoted/internal/impl/printers/Extractors.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ object Extractors {
131131
this += "TypeIdent(\"" += name += "\")"
132132
case TypeSelect(qualifier, name) =>
133133
this += "TypeSelect(" += qualifier += ", \"" += name += "\")"
134-
case Projection(qualifier, name) =>
134+
case TypeProjection(qualifier, name) =>
135135
this += "Projection(" += qualifier += ", \"" += name += "\")"
136136
case Singleton(ref) =>
137137
this += "Singleton(" += ref += ")"

compiler/src/scala/quoted/internal/impl/printers/SourceCode.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ object SourceCode {
10031003
case TypeSelect(qual, name) =>
10041004
printTree(qual) += "." += highlightTypeDef(name)
10051005

1006-
case Projection(qual, name) =>
1006+
case TypeProjection(qual, name) =>
10071007
printTypeTree(qual) += "#" += highlightTypeDef(name)
10081008

10091009
case Singleton(ref) =>

library/src/scala/quoted/QuoteContext.scala

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ trait QuoteContext { self: internal.QuoteUnpickler & internal.QuoteMatching =>
107107
* +- TypeTree ----+- Inferred
108108
* | +- TypeIdent
109109
* | +- TypeSelect
110-
* | +- Projection
110+
* | +- TypeProjection
111111
* | +- Singleton
112112
* | +- Refined
113113
* | +- Applied
@@ -1323,28 +1323,28 @@ trait QuoteContext { self: internal.QuoteUnpickler & internal.QuoteMatching =>
13231323
end TypeSelectMethods
13241324

13251325
/** Type tree representing a selection of definition with a given name on a given type prefix */
1326-
type Projection <: TypeTree
1326+
type TypeProjection <: TypeTree
13271327

1328-
given TypeTest[Tree, Projection] = ProjectionTypeTest
1329-
protected val ProjectionTypeTest: TypeTest[Tree, Projection]
1328+
given TypeTest[Tree, TypeProjection] = TypeProjectionTypeTest
1329+
protected val TypeProjectionTypeTest: TypeTest[Tree, TypeProjection]
13301330

1331-
val Projection: ProjectionModule
1331+
val TypeProjection: TypeProjectionModule
13321332

1333-
trait ProjectionModule { this: Projection.type =>
1333+
trait TypeProjectionModule { this: TypeProjection.type =>
13341334
// TODO def apply(qualifier: TypeTree, name: String): Project
1335-
def copy(original: Tree)(qualifier: TypeTree, name: String): Projection
1336-
def unapply(x: Projection): Option[(TypeTree, String)]
1335+
def copy(original: Tree)(qualifier: TypeTree, name: String): TypeProjection
1336+
def unapply(x: TypeProjection): Option[(TypeTree, String)]
13371337
}
13381338

1339-
given ProjectionMethods as ProjectionMethods = ProjectionMethodsImpl
1340-
protected val ProjectionMethodsImpl: ProjectionMethods
1339+
given TypeProjectionMethods as TypeProjectionMethods = TypeProjectionMethodsImpl
1340+
protected val TypeProjectionMethodsImpl: TypeProjectionMethods
13411341

1342-
trait ProjectionMethods:
1343-
extension (self: Projection):
1342+
trait TypeProjectionMethods:
1343+
extension (self: TypeProjection):
13441344
def qualifier: TypeTree
13451345
def name: String
13461346
end extension
1347-
end ProjectionMethods
1347+
end TypeProjectionMethods
13481348

13491349
/** Type tree representing a singleton type */
13501350
type Singleton <: TypeTree
@@ -3494,7 +3494,7 @@ trait QuoteContext { self: internal.QuoteUnpickler & internal.QuoteMatching =>
34943494
case Inferred() => x
34953495
case TypeIdent(_) => x
34963496
case TypeSelect(qualifier, _) => foldTree(x, qualifier)(owner)
3497-
case Projection(qualifier, _) => foldTree(x, qualifier)(owner)
3497+
case TypeProjection(qualifier, _) => foldTree(x, qualifier)(owner)
34983498
case Singleton(ref) => foldTree(x, ref)(owner)
34993499
case Refined(tpt, refinements) => foldTrees(foldTree(x, tpt)(owner), refinements)(owner)
35003500
case Applied(tpt, args) => foldTrees(foldTree(x, tpt)(owner), args)(owner)
@@ -3646,8 +3646,8 @@ trait QuoteContext { self: internal.QuoteUnpickler & internal.QuoteMatching =>
36463646
case tree: TypeIdent => tree
36473647
case tree: TypeSelect =>
36483648
TypeSelect.copy(tree)(tree.qualifier, tree.name)
3649-
case tree: Projection =>
3650-
Projection.copy(tree)(tree.qualifier, tree.name)
3649+
case tree: TypeProjection =>
3650+
TypeProjection.copy(tree)(tree.qualifier, tree.name)
36513651
case tree: Annotated =>
36523652
Annotated.copy(tree)(tree.arg, tree.annotation)
36533653
case tree: Singleton =>

0 commit comments

Comments
 (0)