Skip to content

Commit fb91e30

Browse files
committed
More doc fixes (outside contextual)
1 parent de9c1c0 commit fb91e30

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

docs/docs/contributing/debugging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ But you can also do:
8888
assertPositioned(tree.reporting(s"Tree is: $result"))
8989
```
9090

91-
`def (a: A).reporting(f: given WrappedResult[T] => String, p: Printer = Printers.default): A` is defined on all types. The function `f` can be written without the argument since the argument is `given`. The `result` variable is a part of the `WrapperResult` – a tiny framework powering the `reporting` function. Basically, whenever you are using `reporting` on an object `A`, you can use the `result: A` variable from this function and it will be equal to the object you are calling `reporting` on.
91+
`def (a: A).reporting(f: WrappedResult[T] ?=> String, p: Printer = Printers.default): A` is defined on all types. The function `f` can be written without the argument since it is a context function`. The `result` variable is a part of the `WrapperResult` – a tiny framework powering the `reporting` function. Basically, whenever you are using `reporting` on an object `A`, you can use the `result: A` variable from this function and it will be equal to the object you are calling `reporting` on.
9292

9393
## Printing out trees after phases
9494
To print out the trees you are compiling after the FrontEnd (scanner, parser, namer, typer) phases:

docs/docs/reference/changed-features/eta-expansion-spec.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ val bar = foo // val bar: Int => Float = ...
5050

5151
## Automatic Eta-Expansion and query types
5252

53-
A method with inferable parameters can be expanded to a value of query type by writing the expected query type explicitly.
53+
A method with context parameters can be expanded to a value of a context type by writing the expected context type explicitly.
5454

5555
```scala
56-
def foo(x: Int) given (p: Double): Float = ???
57-
val bar: given Double => Float = foo(3) // val bar: given Double => Float = ...
56+
def foo(x: Int)(using p: Double): Float = ???
57+
val bar: Double ?=> Float = foo(3)
5858
```
5959

6060
## Rules

docs/docs/reference/contextual/derivation-macro.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ we need to implement a method `Eq.derived` on the companion object of `Eq` that
2525
produces a quoted instance for `Eq[T]`. Here is a possible signature,
2626

2727
```scala
28-
given derived[T: Type](using qctx: QuoteContext): Expr[Eq[T]]
28+
given derived[T: Type](using qctx: QuoteContext) as Expr[Eq[T]]
2929
```
3030

3131
and for comparison reasons we give the same signature we had with `inline`:
3232

3333
```scala
34-
inline given derived[T]: (m: Mirror.Of[T]) => Eq[T] = ???
34+
inline given derived[T] as (m: Mirror.Of[T]) => Eq[T] = ???
3535
```
3636

3737
Note, that since a type is used in a subsequent stage it will need to be lifted
@@ -41,7 +41,7 @@ from the signature. The body of the `derived` method is shown below:
4141

4242

4343
```scala
44-
given derived[T: Type](using qctx: QuoteContext): Expr[Eq[T]] = {
44+
given derived[T: Type](using qctx: QuoteContext) as Expr[Eq[T]] = {
4545
import qctx.tasty.{_, given}
4646

4747
val ev: Expr[Mirror.Of[T]] = summonExpr(using '[Mirror.Of[T]]).get
@@ -175,7 +175,7 @@ object Eq {
175175
case '[Unit] => Nil
176176
}
177177

178-
given derived[T: Type](using qctx: QuoteContext): Expr[Eq[T]] = {
178+
given derived[T: Type](using qctx: QuoteContext) as Expr[Eq[T]] = {
179179
import qctx.tasty.{_, given}
180180

181181
val ev: Expr[Mirror.Of[T]] = summonExpr(using '[Mirror.Of[T]]).get

docs/docs/reference/other-new-features/quoted-pattern-spec.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Splices can be of two forms:
1212
* A splice `${ ... : Bind[T] }` that can be placed on names of `val`s, `var`s or `def`s
1313

1414
```scala
15-
def foo(x: Expr[Int]) given tasty.Reflect: Expr[Int] = x match {
15+
def foo(x: Expr[Int])(using tasty.Reflect): Expr[Int] = x match {
1616
case '{ val $a: Int = $x; (${Bind(`a`)}: Int) + 1 } => '{ $x + 1 } // TODO needs fix for #6328, `a` is currently not in scope while typing
1717
}
1818
```
@@ -21,7 +21,7 @@ In the example above we have `$a` which provides a `Bind[Int]`, `$x` which provi
2121
Quoted patterns are transformed during typer to a call of `scala.internal.quoted.Expr.unapply` which splits the quoted code into the patterns and a reifiable quote that will be used as witnesses at runtime.
2222

2323
```scala
24-
def foo(x: Expr[Int]) given tasty.Reflect: Expr[Int] = x match {
24+
def foo(x: Expr[Int])(using tasty.Reflect): Expr[Int] = x match {
2525
case scala.internal.quoted.Expr.unapply[Tuple3[Bind[Int], Expr[Int], Expr[Int]]](Tuple3(a, x, Bind(`a`), y))('{ @patternBindHole val a: Int = patternHole[Int]; patternHole[Int] + 1 }) =>
2626
}
2727
```

0 commit comments

Comments
 (0)