Skip to content

Commit 6e1f4c3

Browse files
committed
Homogenize abstract module naming and add docs
1 parent 121ced4 commit 6e1f4c3

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`.
@@ -184,7 +196,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
184196
*
185197
* @syntax markdown
186198
*/
187-
trait Reflection { self: reflect.type =>
199+
trait reflectModule { self: reflect.type =>
188200

189201
///////////////
190202
// TREES //
@@ -3013,7 +3025,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
30133025
* It is the meta-programmer's responsibility to provide exactly one corresponding definition by passing
30143026
* this symbol to the ValDef constructor.
30153027
*
3016-
* Note: Also see Reflection.let
3028+
* Note: Also see reflect.let
30173029
*
30183030
* @param flags extra flags to with which the symbol should be constructed
30193031
* @param privateWithin the symbol within which this new method symbol should be private. May be noSymbol.
@@ -3768,7 +3780,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
37683780
// UTILS //
37693781
///////////////
37703782

3771-
/** TASTy Reflect tree accumulator.
3783+
/** Customizable Tree accumulator.
37723784
*
37733785
* Usage:
37743786
* ```
@@ -3871,7 +3883,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
38713883
end TreeAccumulator
38723884

38733885

3874-
/** TASTy Reflect tree traverser.
3886+
/** Customizable tree traverser.
38753887
*
38763888
* Usage:
38773889
* ```
@@ -3891,7 +3903,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
38913903

38923904
end TreeTraverser
38933905

3894-
/** TASTy Reflect tree map.
3906+
/** Customizable tree mapper.
38953907
*
38963908
* Usage:
38973909
* ```

0 commit comments

Comments
 (0)