From 138517d561654ab54cdca33a33fba4ac224821d9 Mon Sep 17 00:00:00 2001 From: Maxime Kjaer Date: Tue, 27 Apr 2021 16:53:07 +0200 Subject: [PATCH 1/3] Fix typos in scala.quoted documentation --- library/src/scala/quoted/Expr.scala | 2 +- library/src/scala/quoted/Quotes.scala | 20 +++++++++++--------- library/src/scala/quoted/Type.scala | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/library/src/scala/quoted/Expr.scala b/library/src/scala/quoted/Expr.scala index acc9581b210a..24e9de48152c 100644 --- a/library/src/scala/quoted/Expr.scala +++ b/library/src/scala/quoted/Expr.scala @@ -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 diff --git a/library/src/scala/quoted/Quotes.scala b/library/src/scala/quoted/Quotes.scala index 96424a176b35..380a88d7b395 100644 --- a/library/src/scala/quoted/Quotes.scala +++ b/library/src/scala/quoted/Quotes.scala @@ -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` */ @@ -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) @@ -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) @@ -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` */ @@ -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 @@ -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 @@ -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] @@ -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` */ diff --git a/library/src/scala/quoted/Type.scala b/library/src/scala/quoted/Type.scala index 9077a626fc66..3009f2828c27 100644 --- a/library/src/scala/quoted/Type.scala +++ b/library/src/scala/quoted/Type.scala @@ -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 From 0c1d5785efcc19c445ad54fb0aeb417198949d68 Mon Sep 17 00:00:00 2001 From: Maxime Kjaer Date: Tue, 27 Apr 2021 16:57:24 +0200 Subject: [PATCH 2/3] Improve documentation of Type.valueOfConstant --- library/src/scala/quoted/Type.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/src/scala/quoted/Type.scala b/library/src/scala/quoted/Type.scala index 3009f2828c27..dcef5eb82b5f 100644 --- a/library/src/scala/quoted/Type.scala +++ b/library/src/scala/quoted/Type.scala @@ -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 From 15f21c2d6de0f7161214ee70d3a8d32d36ae672a Mon Sep 17 00:00:00 2001 From: Maxime Kjaer Date: Tue, 27 Apr 2021 17:12:25 +0200 Subject: [PATCH 3/3] Improve documentation of scala.quoted.Symbol --- library/src/scala/quoted/Quotes.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/scala/quoted/Quotes.scala b/library/src/scala/quoted/Quotes.scala index 380a88d7b395..9c69d731061e 100644 --- a/library/src/scala/quoted/Quotes.scala +++ b/library/src/scala/quoted/Quotes.scala @@ -3343,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