Skip to content

Commit 5eb3258

Browse files
authored
Merge pull request #11480 from michelou/scala3-docs
more fixes in Markdown files
2 parents aa7c21e + 875cd41 commit 5eb3258

File tree

8 files changed

+31
-21
lines changed

8 files changed

+31
-21
lines changed

docs/docs/internals/syntax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ GivenDef ::= [GivenSig] (AnnotType [‘=’ Expr] | StructuralInstance
405405
GivenSig ::= [id] [DefTypeParamClause] {UsingParamClause} ‘:’ -- one of `id`, `DefParamClause`, `UsingParamClause` must be present
406406
StructuralInstance ::= ConstrApp {‘with’ ConstrApp} ‘with’ TemplateBody
407407
Extension ::= ‘extension’ [DefTypeParamClause] ‘(’ DefParam ‘)’
408-
{UsingParamClause}] ExtMethods
408+
{UsingParamClause} ExtMethods
409409
ExtMethods ::= ExtMethod | [nl] <<< ExtMethod {semi ExtMethod} >>>
410410
ExtMethod ::= {Annotation [nl]} {Modifier} ‘def’ DefDef
411411
Template ::= InheritClauses [TemplateBody]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ For methods with one or more parameters like in the example above, this restrict
2424

2525
## Automatic eta-expansion and partial application
2626
In the following example `m` can be partially applied to the first two parameters.
27-
Assignining `m` to `f1` will automatically eta-expand.
27+
Assigning `m` to `f1` will automatically eta-expand.
2828

2929
```scala
3030
def m(x: Boolean, y: String)(z: Int): List[Int]

docs/docs/reference/contextual/extension-methods.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,16 @@ TemplateStat ::= ... | Extension
290290
TopStat ::= ... | Extension
291291
Extension ::= ‘extension’ [DefTypeParamClause] ‘(’ DefParam ‘)’
292292
{UsingParamClause} ExtMethods
293-
ExtMethods ::= ExtMethod | [nl] ‘{’ ExtMethod {semi ExtMethod ‘}’
293+
ExtMethods ::= ExtMethod | [nl] <<< ExtMethod {semi ExtMethod} >>>
294294
ExtMethod ::= {Annotation [nl]} {Modifier} ‘def’ DefDef
295295
```
296296

297+
In the above the notation `<<< ts >>>` in the production rule `ExtMethods` is defined as follows :
298+
299+
```
300+
<<< ts >>> ::= ‘{’ ts ‘}’ | indent ts outdent
301+
```
302+
297303
`extension` is a soft keyword. It is recognized as a keyword only if it appears
298304
at the start of a statement and is followed by `[` or `(`. In all other cases
299305
it is treated as an identifier.

docs/docs/reference/dropped-features/do-while.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,5 @@ do print(".")
3636

3737
### Why Drop The Construct?
3838

39-
- `do-while` is used relatively rarely and it can expressed faithfully using just `while`. So there seems to be little point in having it as a separate syntax construct.
40-
- Under the [new syntax rules](../other-new-features/control-syntax.md) `do` is used
41-
as a statement continuation, which would clash with its meaning as a statement
42-
introduction.
39+
- `do-while` is used relatively rarely and it can be expressed faithfully using just `while`. So there seems to be little point in having it as a separate syntax construct.
40+
- Under the [new syntax rules](../other-new-features/control-syntax.md) `do` is used as a statement continuation, which would clash with its meaning as a statement introduction.

docs/docs/reference/dropped-features/package-objects.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ The compiler generates synthetic objects that wrap top-level definitions falling
3333

3434
If a source file `src.scala` contains such top-level definitions, they will be put in a synthetic object named `src$package`. The wrapping is transparent, however. The definitions in `src` can still be accessed as members of the enclosing package.
3535

36-
**Note 1:** This means that the name of a source file containing wrapped top-level definitions is relevant for binary compatibility. If the name changes, so does the name of the generated object and its class.
36+
**Note:** This means that
37+
1. The name of a source file containing wrapped top-level definitions is relevant for binary compatibility. If the name changes, so does the name of the generated object and its class.
3738

38-
**Note 2:** A top-level main method `def main(args: Array[String]): Unit = ...` is wrapped as any other method. If it appears
39+
2. A top-level main method `def main(args: Array[String]): Unit = ...` is wrapped as any other method. If it appears
3940
in a source file `src.scala`, it could be invoked from the command line using a command like `scala src$package`. Since the
4041
"program name" is mangled it is recommended to always put `main` methods in explicitly named objects.
4142

42-
**Note 3:** The notion of `private` is independent of whether a definition is wrapped or not. A `private` top-level definition is always visible from everywhere in the enclosing package.
43+
3. The notion of `private` is independent of whether a definition is wrapped or not. A `private` top-level definition is always visible from everywhere in the enclosing package.
4344

44-
**Note 4:** If several top-level definitions are overloaded variants with the same name,
45+
4. If several top-level definitions are overloaded variants with the same name,
4546
they must all come from the same source file.

docs/docs/reference/dropped-features/procedure-syntax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ def f(): Unit = { ... }
1414
```
1515
Scala 3 accepts the old syntax under the `-source:3.0-migration` option.
1616
If the `-migration` option is set, it can even rewrite old syntax to new.
17-
The [ScalaFix](https://scalacenter.github.io/scalafix/) tool also
17+
The [Scalafix](https://scalacenter.github.io/scalafix/) tool also
1818
can rewrite procedure syntax to make it Scala 3 compatible.

docs/docs/reference/dropped-features/weak-conformance-spec.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ To simplify the underlying type theory, Scala 3 drops the notion of
88
altogether. Instead, it provides more flexibility when
99
assigning a type to a constant expression. The new rule is:
1010

11-
- If a list of expressions `Es` appears as one of
11+
- *If* a list of expressions `Es` appears as one of
1212

1313
- the elements of a vararg parameter, or
1414
- the alternatives of an if-then-else or match expression, or
1515
- the body and catch results of a try expression,
1616

17-
and all expressions have primitive numeric types, but they do not
18-
all have the same type, then the following is attempted:
17+
- *and* all expressions have primitive numeric types, but they do not
18+
all have the same type,
19+
20+
- *then* the following is attempted:
1921

2022
- the expressions `Es` are partitioned into `Int` constants on the
2123
one hand, and all other expressions on the other hand,
@@ -27,12 +29,15 @@ assigning a type to a constant expression. The new rule is:
2729
unchanged regardless),
2830
- otherwise, the expressions `Es` are used unchanged.
2931

30-
A loss of precision occurs for an `Int -> Float` conversion of a constant
31-
`c` if `c.toFloat.toInt != c`. For an `Int -> Byte` conversion it occurs
32-
if `c.toByte.toInt != c`. For an `Int -> Short` conversion, it occurs
33-
if `c.toShort.toInt != c`.
32+
A loss of precision occurs for
33+
- an `Int -> Float` conversion of a constant
34+
`c` if `c.toFloat.toInt != c`
35+
- an `Int -> Byte` conversion of a constant
36+
`c` if `c.toByte.toInt != c`,
37+
- an `Int -> Short` conversion of a constant
38+
`c` if `c.toShort.toInt != c`.
3439

35-
## Examples
40+
### Examples
3641

3742
```scala
3843
inline val b = 33

docs/docs/reference/syntax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ GivenDef ::= [GivenSig] (AnnotType [‘=’ Expr] | StructuralInstance
395395
GivenSig ::= [id] [DefTypeParamClause] {UsingParamClause} ‘:’ -- one of `id`, `DefParamClause`, `UsingParamClause` must be present
396396
StructuralInstance ::= ConstrApp {‘with’ ConstrApp} ‘with’ TemplateBody
397397
Extension ::= ‘extension’ [DefTypeParamClause] ‘(’ DefParam ‘)’
398-
{UsingParamClause}] ExtMethods
398+
{UsingParamClause} ExtMethods
399399
ExtMethods ::= ExtMethod | [nl] <<< ExtMethod {semi ExtMethod} >>>
400400
ExtMethod ::= {Annotation [nl]} {Modifier} ‘def’ DefDef
401401
Template ::= InheritClauses [TemplateBody]

0 commit comments

Comments
 (0)