Skip to content

Commit dd462eb

Browse files
authored
Merge pull request #10534 from SethTisue/locally
2 parents 8201bc8 + beee8f5 commit dd462eb

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

docs/docs/reference/other-new-features/indentation.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,17 @@ xs.map:
387387
y * y
388388
```
389389

390-
Colons at the end of lines are their own token, distinct from normal `:`.
391-
The Scala grammar is changed in this variant so that colons at end of lines are accepted at all points
392-
where an opening brace enclosing a function argument is legal. Special provisions are taken so that method result types can still use a colon on the end of a line, followed by the actual type on the next.
390+
The colon is usable not only for lambdas and by-name parameters, but
391+
also even for ordinary parameters:
392+
393+
```scala
394+
credentials ++ :
395+
val file = Path.userHome / ".credentials"
396+
if file.exists
397+
then Seq(Credentials(file))
398+
else Seq()
399+
```
400+
401+
How does this syntax variant work? Colons at the end of lines are their own token, distinct from normal `:`.
402+
The Scala grammar is changed so that colons at end of lines are accepted at all points
403+
where an opening brace enclosing an argument is legal. Special provisions are taken so that method result types can still use a colon on the end of a line, followed by the actual type on the next.

0 commit comments

Comments
 (0)