Skip to content

Commit 2b1c5de

Browse files
elootsBlaisorblade
authored andcommitted
Fix #8086: fix typos in extension method example
Fix #8086: fix typos in extension method example Co-authored-by: Paolo G. Giarrusso <[email protected]>
1 parent a7c8920 commit 2b1c5de

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Extension methods allow one to add methods to a type after the type is defined.
1111
```scala
1212
case class Circle(x: Double, y: Double, radius: Double)
1313

14-
def (c: Circle).circumference: Double = c.radius * math.Pi * 2
14+
def (c: Circle) circumference: Double = c.radius * math.Pi * 2
1515
```
1616

1717
Like regular methods, extension methods can be invoked with infix `.`:
@@ -143,7 +143,7 @@ extension listOps on [T](xs: List[T]) {
143143
def third: T = xs.tail.tail.head
144144
}
145145

146-
extension on [T](xs: List[T]) with Ordering[T]) {
146+
extension on [T](xs: List[T]) with Ordering[T] {
147147
def largest(n: Int) = xs.sorted.takeRight(n)
148148
}
149149
```

0 commit comments

Comments
 (0)