Skip to content

Minor fixes to scala.quoted docs #12243

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 3 commits into from
Apr 27, 2021
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 library/src/scala/quoted/Expr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ object Expr {
* to an expression equivalent to
* `'{ List($e1, $e2, ...) }` typed as an `Expr[List[T]]`
*/
def ofList[T](xs: Seq[Expr[T]])(using Type[T])(using Quotes): Expr[List[T]] =
def ofList[T](xs: Seq[Expr[T]])(using Type[T])(using Quotes): Expr[List[T]] =
if (xs.isEmpty) Expr(Nil) else '{ List(${Varargs(xs)}: _*) }

/** Creates an expression that will construct a copy of this tuple
Expand Down
22 changes: 12 additions & 10 deletions library/src/scala/quoted/Quotes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,9 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
end extension
end NamedArgMethods

/** Tree an application of arguments. It represents a single list of arguments, multiple argument lists will have nested `Apply`s */
/** Tree representing an application of arguments.
* It represents a single list of arguments, multiple argument lists will have nested `Apply`s
*/
type Apply <: Term

/** `TypeTest` that allows testing at runtime in a pattern match if a `Tree` is an `Apply` */
Expand Down Expand Up @@ -968,7 +970,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
extension (self: Apply)
/** The `fun` part of an (implicit) application like `fun(args)`
*
* It maybe a partially applied method:
* It may be a partially applied method:
* ```scala
* def f(x1: Int)(x2: Int) = ...
* f(1)(2)
Expand All @@ -980,7 +982,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
def fun: Term
/** The arguments (implicitly) passed to the method
*
* The `Apply` maybe a partially applied method:
* The `Apply` may be a partially applied method:
* ```scala
* def f(x1: Int)(x2: Int) = ...
* f(1)(2)
Expand All @@ -993,7 +995,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
end extension
end ApplyMethods

/** Tree an application of type arguments */
/** Tree representing an application of type arguments */
type TypeApply <: Term

/** `TypeTest` that allows testing at runtime in a pattern match if a `Tree` is a `TypeApply` */
Expand Down Expand Up @@ -1022,7 +1024,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
extension (self: TypeApply)
/** The `fun` part of an (inferred) type application like `fun[Args]`
*
* It maybe a partially applied method:
* It may be a partially applied method:
* ```scala
* extension (x: Int) def f[T](y: T) = ...
* // represented as
Expand All @@ -1038,7 +1040,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
def fun: Term
/** The (inferred) type arguments passed to the method
*
* The `TypeApply` maybe a partially applied method:
* The `TypeApply` may be a partially applied method:
* ```scala
* extension (x: Int) def f[T](y: T) = ...
* // represented as
Expand Down Expand Up @@ -1934,9 +1936,9 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>

/** Type tree representing wildcard type bounds written in the source.
* The wildcard type `_` (for example in in `List[_]`) will be a type tree that
* represents a type but has `TypeBound`a inside.
* represents a type but has `TypeBounds` inside.
*/
type WildcardTypeTree <: Tree
type WildcardTypeTree <: Tree

/** `TypeTest` that allows testing at runtime in a pattern match if a `Tree` is a `WildcardTypeTree` */
given WildcardTypeTreeTypeTest: TypeTest[Tree, WildcardTypeTree]
Expand Down Expand Up @@ -3341,7 +3343,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
/////////////

/** Symbol of a definition.
* Then can be compared with == to know if the definition is the same.
* Symbols can be compared with `==` to know if two definitions are the same.
*/
type Symbol <: AnyRef

Expand Down Expand Up @@ -4097,7 +4099,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
// REPORTING //
///////////////

/** Module containing error and waring reporting. */
/** Module containing error and warning reporting. */
val report: reportModule

/** Methods of the module object `val report` */
Expand Down
6 changes: 4 additions & 2 deletions library/src/scala/quoted/Type.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import scala.annotation.compileTimeOnly

/** Type (or type constructor) `T` needed contextually when using `T` in a quoted expression `'{... T ...}` */
abstract class Type[T <: AnyKind] private[scala]:
/** The type represented `Type` */
/** The type represented by `Type` */
type Underlying = T
end Type

Expand All @@ -21,7 +21,9 @@ object Type:
given of[T <: AnyKind](using Quotes): Type[T] = ???


/** Extracts the value of singleton constant type, None otherwise.
/** Extracts the value of a singleton constant type.
* Returns Some of the value of the type if it is a singleton constant type.
* Returns None if the type is not a singleton constant type.
*
* Example usage:
* ```scala
Expand Down