Skip to content

Commit a081a74

Browse files
Merge pull request #11815 from dotty-staging/fix-docs-of-scala-quoted
Fix typos and update docs of `scala.quoted`
2 parents 11265bc + 4a56294 commit a081a74

11 files changed

+198
-202
lines changed

library/src/scala/quoted/Expr.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ object Expr {
2323
case Some(expr1) => expr1.asExpr.asInstanceOf[Expr[T]]
2424
case _ => expr
2525

26-
/** Returns an expression containing a block with the given statements and ending with the expresion
26+
/** Returns an expression containing a block with the given statements and ending with the expression
2727
* Given list of statements `s1 :: s2 :: ... :: Nil` and an expression `e` the resulting expression
2828
* will be equivalent to `'{ $s1; $s2; ...; $e }`.
2929
*/
@@ -46,7 +46,7 @@ object Expr {
4646
* // value: T
4747
* ```
4848
*
49-
* To directly get the value of an expression `expr: Expr[T]` consider using `expr.value`/`expr.valueOrError` insead.
49+
* To directly get the value of an expression `expr: Expr[T]` consider using `expr.value`/`expr.valueOrError` instead.
5050
* @syntax markdown
5151
*/
5252
def unapply[T](x: Expr[T])(using FromExpr[T])(using Quotes): Option[T] =

library/src/scala/quoted/ExprMap.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ trait ExprMap:
55
/** Map an expression `e` with a type `T` */
66
def transform[T](e: Expr[T])(using Type[T])(using Quotes): Expr[T]
77

8-
/** Map subexpressions an expression `e` with a type `T` */
8+
/** Map sub-expressions an expression `e` with a type `T` */
99
def transformChildren[T](e: Expr[T])(using Type[T])(using Quotes): Expr[T] = {
1010
import quotes.reflect._
1111
final class MapChildren() {
@@ -99,9 +99,9 @@ trait ExprMap:
9999
case _: Inlined =>
100100
transformTermChildren(tree, tpe)(owner)
101101
case _ if tree.isExpr =>
102-
// WARNING: Never do a cast like this in user code (accepable within the stdlib).
102+
// WARNING: Never do a cast like this in user code (acceptable within the stdlib).
103103
// In theory we should use `tree.asExpr match { case '{ $expr: t } => transform(expr).asTerm }`
104-
// This is to avoid conflicts when re-boostrapping the library.
104+
// This is to avoid conflicts when re-bootstrapping the library.
105105
type X
106106
val expr = tree.asExpr.asInstanceOf[Expr[X]]
107107
val t = tpe.asType.asInstanceOf[Type[X]]

library/src/scala/quoted/Exprs.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ object Exprs:
1414
* ...
1515
* }
1616
* ```
17-
* To directly get the value of all expressions in a sequence `exprs: Seq[Expr[T]]` consider using `exprs.map(_.value)`/`exprs.map(_.valueOrError)` insead.
17+
* To directly get the value of all expressions in a sequence `exprs: Seq[Expr[T]]` consider using `exprs.map(_.value)`/`exprs.map(_.valueOrError)` instead.
1818
*/
1919
def unapply[T](exprs: Seq[Expr[T]])(using FromExpr[T])(using Quotes): Option[Seq[T]] =
2020
val builder = Seq.newBuilder[T]

library/src/scala/quoted/FromExpr.scala

Lines changed: 98 additions & 98 deletions
Large diffs are not rendered by default.

library/src/scala/quoted/Quotes.scala

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ transparent inline def quotes(using inline q: Quotes): q.type = q
1919
* Used to perform all operations on quoted `Expr` or `Type`.
2020
*
2121
* It contains the low-level Typed AST API metaprogramming API.
22-
* This API does not have the static type guarantiees that `Expr` and `Type` provide.
22+
* This API does not have the static type guarantees that `Expr` and `Type` provide.
2323
*/
2424
trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
2525

@@ -283,7 +283,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
283283

284284
}
285285

286-
/** Tree representing a pacakage clause in the source code
286+
/** Tree representing a package clause in the source code
287287
*
288288
* ```scala
289289
* package foo {
@@ -475,7 +475,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
475475
*
476476
* ```scala
477477
* class C {
478-
* ... // statemets
478+
* ... // statements
479479
* }
480480
* ```
481481
* @syntax markdown
@@ -511,7 +511,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
511511
/** List of type and term parameter clauses */
512512
def paramss: List[ParamClause]
513513

514-
/** List of leading type paramters or Nil if the method does not have leading type paramters.
514+
/** List of leading type parameters or Nil if the method does not have leading type parameters.
515515
*
516516
* Note: Non leading type parameters can be found in extension methods such as
517517
* ```scala
@@ -522,7 +522,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
522522
def leadingTypeParams: List[TypeDef]
523523

524524
/** List of parameter clauses following the leading type parameters or all clauses.
525-
* Return all parameter clauses if there are no leading type paramters.
525+
* Return all parameter clauses if there are no leading type parameters.
526526
*
527527
* Non leading type parameters can be found in extension methods such as
528528
* ```scala
@@ -539,15 +539,15 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
539539
def returnTpt: TypeTree
540540

541541
/** The tree of the implementation of the method.
542-
* Returns `None` if the method does not hava an implemetation.
542+
* Returns `None` if the method does not have an implementation.
543543
*/
544544
def rhs: Option[Term]
545545
end extension
546546
end DefDefMethods
547547

548548
// ValDef
549549

550-
/** Tree representing a value definition in the source code This inclues `val`, `lazy val`, `var`, `object` and parameter defintions. */
550+
/** Tree representing a value definition in the source code This includes `val`, `lazy val`, `var`, `object` and parameter definitions. */
551551
type ValDef <: Definition
552552

553553
/** `TypeTest` that allows testing at runtime in a pattern match if a `Tree` is a `ValDef` */
@@ -659,7 +659,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
659659
/** Replace Ident nodes references to the underlying tree that defined them */
660660
def underlying: Term
661661

662-
/** Converts a partally applied term into a lambda expression */
662+
/** Converts a partially applied term into a lambda expression */
663663
def etaExpand(owner: Symbol): Term
664664

665665
/** A unary apply node with given argument: `tree(arg)` */
@@ -1255,7 +1255,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
12551255
* ```
12561256
* @param owner: owner of the generated `meth` symbol
12571257
* @param tpe: Type of the definition
1258-
* @param rhsFn: Funtion that recieves the `meth` symbol and the a list of references to the `params`
1258+
* @param rhsFn: Function that receives the `meth` symbol and the a list of references to the `params`
12591259
* @syntax markdown
12601260
*/
12611261
def apply(owner: Symbol, tpe: MethodType, rhsFn: (Symbol, List[Tree]) => Tree): Block
@@ -2102,7 +2102,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
21022102

21032103
/** A parameter clause `[X1, ..., Xn]` or `(x1: X1, ..., xn: Xx)`
21042104
*
2105-
* `[X1, ..., Xn]` are reresented with `TypeParamClause` and `(x1: X1, ..., xn: Xx)` are represented with `TermParamClause`
2105+
* `[X1, ..., Xn]` are represented with `TypeParamClause` and `(x1: X1, ..., xn: Xx)` are represented with `TermParamClause`
21062106
*
21072107
* `ParamClause` encodes the following enumeration
21082108
* ```scala
@@ -2404,7 +2404,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
24042404

24052405
/** Is this type a function type?
24062406
*
2407-
* @return true if the dealised type of `self` without refinement is `FunctionN[T1, T2, ..., Tn]`
2407+
* @return true if the dealiased type of `self` without refinement is `FunctionN[T1, T2, ..., Tn]`
24082408
*
24092409
* @note The function
24102410
*
@@ -2603,7 +2603,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
26032603
end extension
26042604
end AppliedTypeMethods
26052605

2606-
/** A type with an anottation `T @foo` */
2606+
/** A type with an annotation `T @foo` */
26072607
type AnnotatedType <: TypeRepr
26082608

26092609
/** `TypeTest` that allows testing at runtime in a pattern match if a `TypeRepr` is an `AnnotatedType` */
@@ -3562,7 +3562,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
35623562
/** Get non-private named methods defined directly inside the class */
35633563
def declaredMethod(name: String): List[Symbol]
35643564

3565-
/** Get all non-private methods defined directly inside the class, exluding constructors */
3565+
/** Get all non-private methods defined directly inside the class, excluding constructors */
35663566
def declaredMethods: List[Symbol]
35673567

35683568
/** Get named non-private methods declared or inherited */
@@ -3574,7 +3574,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
35743574
/** Get non-private named methods defined directly inside the class */
35753575
def declaredType(name: String): List[Symbol]
35763576

3577-
/** Get all non-private methods defined directly inside the class, exluding constructors */
3577+
/** Get all non-private methods defined directly inside the class, excluding constructors */
35783578
def declaredTypes: List[Symbol]
35793579

35803580
/** Type member with the given name directly declared in the class */
@@ -3854,7 +3854,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
38543854
def Abstract: Flags
38553855

38563856
/** Is this generated by Scala compiler.
3857-
* Coresponds to ACC_SYNTHETIC in the JVM.
3857+
* Corresponds to ACC_SYNTHETIC in the JVM.
38583858
*/
38593859
def Artifact: Flags
38603860

@@ -3921,10 +3921,10 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
39213921
/** Is this symbol `lazy` */
39223922
def Lazy: Flags
39233923

3924-
/** Is this symbol local? Used in conjunction with private/private[T] to mean private[this] extends Modifier proctected[this] */
3924+
/** Is this symbol local? Used in conjunction with private/private[T] to mean private[this] extends Modifier protected[this] */
39253925
def Local: Flags
39263926

3927-
/** Is this symbol marked as a macro. An inline method containing toplevel splices */
3927+
/** Is this symbol marked as a macro. An inline method containing top level splices */
39283928
def Macro: Flags
39293929

39303930
def Method: Flags
@@ -4093,7 +4093,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
40934093
// REPORTING //
40944094
///////////////
40954095

4096-
/** Module containg error and waring reporiting. */
4096+
/** Module containing error and waring reporting. */
40974097
val report: reportModule
40984098

40994099
/** Methods of the module object `val report` */
@@ -4147,7 +4147,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
41474147
*
41484148
* Usage:
41494149
* ```scala
4150-
* import qctx.reflect._
4150+
* import quotes.reflect._
41514151
* class MyTreeAccumulator extends TreeAccumulator[X] {
41524152
* def foldTree(x: X, tree: Tree)(owner: Symbol): X = ...
41534153
* }
@@ -4251,7 +4251,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
42514251
*
42524252
* Usage:
42534253
* ```scala
4254-
* import qctx.relfect._
4254+
* import quotes.relfect._
42554255
* class MyTraverser extends TreeTraverser {
42564256
* override def traverseTree(tree: Tree)(owner: Symbol): Unit = ...
42574257
* }
@@ -4461,15 +4461,15 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
44614461

44624462
/** Methods of the module object `val Printer` */
44634463
trait PrinterModule { self: Printer.type =>
4464-
/** Prints fully elaborated vesion of the source code. */
4464+
/** Prints fully elaborated version of the source code. */
44654465
def TreeCode: Printer[Tree]
44664466

4467-
/** Prints fully elaborated vesion of the source code.
4467+
/** Prints fully elaborated version of the source code.
44684468
* Same as `TreeCode` but does not print full package prefixes.
44694469
*/
44704470
def TreeShortCode: Printer[Tree]
44714471

4472-
/** Prints fully elaborated vesion of the source code using ANSI colors. */
4472+
/** Prints fully elaborated version of the source code using ANSI colors. */
44734473
def TreeAnsiCode: Printer[Tree]
44744474

44754475
/** Prints a pattern like representation of the `Tree`.

0 commit comments

Comments
 (0)