Skip to content

Commit 7b26811

Browse files
Merge pull request #10677 from dotty-staging/homodenize-abstract-module-names
Homogenize abstract module naming and add docs
2 parents faa55ee + 6e1f4c3 commit 7b26811

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed

compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
7777
}
7878
end extension
7979

80-
object reflect extends Reflection:
80+
object reflect extends reflectModule:
8181

8282
type Tree = tpd.Tree
8383

library/src/scala/quoted/Quotes.scala

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ inline def quotes(using q: Quotes): q.type = q
1010
*
1111
* It contains the low-level Typed AST API metaprogramming API.
1212
* This API does not have the static type guarantiees that `Expr` and `Type` provide.
13-
*
14-
* @param tasty Typed AST API. Usage: `def f(qctx: Quotes) = { import quotes.reflect._; ... }`.
1513
*/
1614
trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
1715

@@ -66,14 +64,28 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
6664
def asExprOf(using Type[X]): Expr[X]
6765
end extension
6866

69-
/** Low-level Typed AST API metaprogramming API.
70-
* This API does not have the static type guarantiees that `Expr` and `Type` provide.
67+
/** Low-level Typed AST metaprogramming API.
68+
*
69+
* Provides all functionality related to AST-based metaprogramming.
70+
*
71+
* Usage:
72+
* ```scala
73+
* import scala.quoted._
74+
* def f(expr: Expr[Int])(using Quotes) =
75+
* import quotes.reflect._
76+
* val tree: Tree = Term.of(expr)
77+
* ...
78+
* ```
79+
*
80+
* See `reflectModule` for full API.
81+
*
82+
* @syntax markdown
7183
*/
72-
val reflect: Reflection
84+
val reflect: reflectModule
7385

74-
/** AST reflection interface.
86+
/** Low-level Typed AST metaprogramming API.
7587
*
76-
* Provides all functionality related with AST based metaprogramming.
88+
* Provides all functionality related to AST-based metaprogramming.
7789
*
7890
* Each type `XYZ` in the API is defined as an abstract type `type XYZ`.
7991
* Methods on `XYZ` are provided by a `given XYZMethods` which implements extension methods on `XYZ` in the trait `XYZMethods`.
@@ -186,7 +198,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
186198
*
187199
* @syntax markdown
188200
*/
189-
trait Reflection { self: reflect.type =>
201+
trait reflectModule { self: reflect.type =>
190202

191203
///////////////
192204
// TREES //
@@ -3032,7 +3044,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
30323044
* It is the meta-programmer's responsibility to provide exactly one corresponding definition by passing
30333045
* this symbol to the ValDef constructor.
30343046
*
3035-
* Note: Also see Reflection.let
3047+
* Note: Also see reflect.let
30363048
*
30373049
* @param flags extra flags to with which the symbol should be constructed
30383050
* @param privateWithin the symbol within which this new method symbol should be private. May be noSymbol.
@@ -3787,7 +3799,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
37873799
// UTILS //
37883800
///////////////
37893801

3790-
/** TASTy Reflect tree accumulator.
3802+
/** Customizable Tree accumulator.
37913803
*
37923804
* Usage:
37933805
* ```
@@ -3890,7 +3902,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
38903902
end TreeAccumulator
38913903

38923904

3893-
/** TASTy Reflect tree traverser.
3905+
/** Customizable tree traverser.
38943906
*
38953907
* Usage:
38963908
* ```
@@ -3910,7 +3922,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
39103922

39113923
end TreeTraverser
39123924

3913-
/** TASTy Reflect tree map.
3925+
/** Customizable tree mapper.
39143926
*
39153927
* Usage:
39163928
* ```

0 commit comments

Comments
 (0)