Skip to content

Commit

Permalink
Change indentation.md to reflect no colon in extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Jul 4, 2020
1 parent a128dab commit b179a8e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/docs/reference/other-new-features/indentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ There are two rules:
An indentation region can start

- after the condition of an `if-else`, or
- after the leading parameters of an `extension`, or
- after a ": at end of line" token (see below)
- after one of the following tokens:
```
Expand Down Expand Up @@ -94,7 +95,7 @@ at the toplevel, inside braces `{...}`, but not inside parentheses `(...)`, patt

### Optional Braces Around Template Bodies

The Scala grammar uses the term _template body_ for the definitions of a class, trait, object, given instance or extension that are normally enclosed in braces. The braces around a template body can also be omitted by means of the following rule
The Scala grammar uses the term _template body_ for the definitions of a class, trait, object or given instance that are normally enclosed in braces. The braces around a template body can also be omitted by means of the following rule

If at the point where a template body can start there is a `:` that occurs at the end
of a line, and that is followed by at least one indented statement, the recognized
Expand All @@ -120,7 +121,7 @@ enum Color:
type T = A:
def f: Int

given [T] with Ord[T] as Ord[List[T]]:
given [T](using Ord[T]) as Ord[List[T]]:
def compare(x: List[T], y: List[T]) = ???

extension (xs: List[Int])
Expand Down

0 comments on commit b179a8e

Please sign in to comment.