Skip to content

Homogenize abstract module naming and add docs #10677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
}
end extension

object reflect extends Reflection:
object reflect extends reflectModule:

type Tree = tpd.Tree

Expand Down
36 changes: 24 additions & 12 deletions library/src/scala/quoted/Quotes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ inline def quotes(using q: Quotes): q.type = q
*
* It contains the low-level Typed AST API metaprogramming API.
* This API does not have the static type guarantiees that `Expr` and `Type` provide.
*
* @param tasty Typed AST API. Usage: `def f(qctx: Quotes) = { import quotes.reflect._; ... }`.
*/
trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>

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

/** Low-level Typed AST API metaprogramming API.
* This API does not have the static type guarantiees that `Expr` and `Type` provide.
/** Low-level Typed AST metaprogramming API.
*
* Provides all functionality related to AST-based metaprogramming.
*
* Usage:
* ```scala
* import scala.quoted._
* def f(expr: Expr[Int])(using Quotes) =
* import quotes.reflect._
* val tree: Tree = Term.of(expr)
* ...
* ```
*
* See `reflectModule` for full API.
*
* @syntax markdown
*/
val reflect: Reflection
val reflect: reflectModule

/** AST reflection interface.
/** Low-level Typed AST metaprogramming API.
*
* Provides all functionality related with AST based metaprogramming.
* Provides all functionality related to AST-based metaprogramming.
*
* Each type `XYZ` in the API is defined as an abstract type `type XYZ`.
* Methods on `XYZ` are provided by a `given XYZMethods` which implements extension methods on `XYZ` in the trait `XYZMethods`.
Expand Down Expand Up @@ -184,7 +196,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
*
* @syntax markdown
*/
trait Reflection { self: reflect.type =>
trait reflectModule { self: reflect.type =>

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

/** TASTy Reflect tree accumulator.
/** Customizable Tree accumulator.
*
* Usage:
* ```
Expand Down Expand Up @@ -3871,7 +3883,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
end TreeAccumulator


/** TASTy Reflect tree traverser.
/** Customizable tree traverser.
*
* Usage:
* ```
Expand All @@ -3891,7 +3903,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>

end TreeTraverser

/** TASTy Reflect tree map.
/** Customizable tree mapper.
*
* Usage:
* ```
Expand Down