Skip to content

Commit 4034fe0

Browse files
committed
Fix docs
- Fix the syntax of a sentence - Fix a code example
1 parent 53a2dc5 commit 4034fe0

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

docs/docs/reference/changed-features/vararg-splices.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ The syntax of vararg splices in patterns and function arguments has changed. The
77

88
```scala
99
val arr = Array(0, 1, 2, 3)
10-
val lst = List(arr*) // vararg splice argument
10+
val lst = List(arr*) // vararg splice argument
1111
lst match
12-
case List(0, 1, xs*) => println(xs) // binds xs to Seq(2, 3)
13-
case List(1, _*) => // wildcard pattern
12+
case List(0, 1, xs*) => println(xs) // binds xs to Seq(2, 3)
13+
case List(1, _*) => // wildcard pattern
1414
```
1515

1616
The old syntax for splice arguments will be phased out.
1717

1818
```scala
19-
/*!*/ val lst = List(arr: _*) // syntax error
19+
/*!*/ val lst = List(arr: _*) // syntax error
2020
lst match
21-
case List(1, 2, xs @ _*) // ok, equivalent to `xs*`
21+
case List(0, 1, xs @ _*) // ok, equivalent to `xs*`
2222
```
2323

2424
## Syntax
2525

26-
```
26+
```ebnf
2727
ArgumentPatterns ::= ‘(’ [Patterns] ‘)’
2828
| ‘(’ [Patterns ‘,’] Pattern2 ‘*’ ‘)’
2929
@@ -37,6 +37,3 @@ To enable cross compilation between Scala 2 and Scala 3, the compiler will
3737
accept both the old and the new syntax. Under the `-source future` setting, an error
3838
will be emitted when the old syntax is encountered. An automatic rewrite from old
3939
to new syntax is offered under `-source future-migration`.
40-
41-
42-

docs/docs/reference/metaprogramming/inline.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,13 @@ val one: 1 = zero + 1
285285
```
286286

287287
### Transparent vs. non-transparent inline
288+
288289
As we already discussed, transparent inline methods may influence type checking at call site.
289290
Technically this implies that transparent inline methods must be expanded during type checking of the program.
290291
Other inline methods are inlined later after the program is fully typed.
291292

292293
For example, the following two functions will be typed the same way but will be inlined at different times.
294+
293295
```scala
294296
inline def f1: T = ...
295297
transparent inline def f2: T = (...): T
@@ -298,7 +300,7 @@ transparent inline def f2: T = (...): T
298300
A noteworthy difference is the behavior of `transparent inline given`.
299301
If there is an error reported when inlining that definition, it will be considered as an implicit search mismatch and the search will continue.
300302
A `transparent inline given` can add a type ascription in its RHS (as in `f2` from the previous example) to avoid the precise type but keep the search behavior.
301-
On the other hand, `inline given` be taken as the implicit and then inlined after typing.
303+
On the other hand, an `inline given` is taken as an implicit and then inlined after typing.
302304
Any error will be emitted as usual.
303305

304306
## Inline Conditionals

0 commit comments

Comments
 (0)