Skip to content

Commit 5a884b2

Browse files
committed
Fix documentation
1 parent 884c4a0 commit 5a884b2

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,8 +1718,7 @@ object Parsers {
17181718
normalize(loop(start))
17191719
}
17201720

1721-
/** FunArgMods ::= `implicit' FunArgMods
1722-
* | `unused' FunArgMods
1721+
/** FunArgMods ::= { `implicit` | `unused` }
17231722
*/
17241723
def funArgMods = BitSet(IMPLICIT, UNUSED)
17251724

docs/docs/internals/syntax.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ ClassQualifier ::= ‘[’ id ‘]’
120120
Type ::= [FunArgMods] FunArgTypes ‘=>’ Type Function(ts, t)
121121
| HkTypeParamClause ‘=>’ Type TypeLambda(ps, t)
122122
| InfixType
123-
FunArgMods ::= `implicit' FunArgMods
124-
| `unused' FunArgMods
123+
FunArgMods ::= { `implicit` | `unused` }
125124
FunArgTypes ::= InfixType
126125
| ‘(’ [ FunArgType {‘,’ FunArgType } ] ‘)’
127126
| '(' TypedFunParam {',' TypedFunParam } ')'

docs/docs/reference/unused-terms.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ m.turnedOn.turnedOn // ERROR
3434

3535
Note that in the code above the actual implicit arguments for `IsOff` are never used at runtime; they serve only to establish the right constraints at compile time.
3636
As these parameters are never used at runtime there is not real need to have them around, but they still need to be
37-
present at runtime to be able to do separate compilation and retain binary compatiblity. Unused parameters are contractually
38-
obligated to not be used at runtime, enforcing the essence of evidences on types and allows them to always be optimized away.
39-
37+
present at runtime to be able to do separate compilation and retain binary compatiblity.
4038

4139
How to define unused parameter?
4240
-------------------------------
@@ -49,7 +47,7 @@ val lambdaWithUnusedEv: unused Ev => Int =
4947
unused (ev: Ev) => 42
5048
```
5149

52-
Those parameters will not be usable for computations, thought they can be used as arguments to other `unused` parameters.
50+
`unused` parameters will not be usable for computations, though they can be used as arguments to other `unused` parameters.
5351

5452
```scala
5553
def methodWithUnusedInt1(unused i: Int): Int =
@@ -84,7 +82,7 @@ methodWithUnusedEv(evidence1)
8482

8583
State machine with unused evidence example
8684
------------------------------------------
87-
The following examples is an extended implementation of a simple state machine which can be in a state `On` or `Off`.
85+
The following example is an extended implementation of a simple state machine which can be in a state `On` or `Off`.
8886
The machine can change state from `Off` to `On` with `turnedOn` only if it is currently `Off`,
8987
conversely from `On` to `Off` with `turnedOff` only if it is currently `On`. These last constraint are
9088
captured with the `IsOff[S]` and `IsOn[S]` implicit evidence only exist for `IsOff[Off]` and `InOn[On]`.

0 commit comments

Comments
 (0)