From 2b1c5ded4487d4895352ec323017b2a730bd258f Mon Sep 17 00:00:00 2001 From: Eric Loots Date: Fri, 24 Jan 2020 16:48:09 +0100 Subject: [PATCH] Fix #8086: fix typos in extension method example Fix #8086: fix typos in extension method example Co-authored-by: Paolo G. Giarrusso --- docs/docs/reference/contextual/extension-methods.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/reference/contextual/extension-methods.md b/docs/docs/reference/contextual/extension-methods.md index d8307ac6cb2e..f852073659a5 100644 --- a/docs/docs/reference/contextual/extension-methods.md +++ b/docs/docs/reference/contextual/extension-methods.md @@ -11,7 +11,7 @@ Extension methods allow one to add methods to a type after the type is defined. ```scala case class Circle(x: Double, y: Double, radius: Double) -def (c: Circle).circumference: Double = c.radius * math.Pi * 2 +def (c: Circle) circumference: Double = c.radius * math.Pi * 2 ``` Like regular methods, extension methods can be invoked with infix `.`: @@ -143,7 +143,7 @@ extension listOps on [T](xs: List[T]) { def third: T = xs.tail.tail.head } -extension on [T](xs: List[T]) with Ordering[T]) { +extension on [T](xs: List[T]) with Ordering[T] { def largest(n: Int) = xs.sorted.takeRight(n) } ```