Skip to content

Fix docs code examples for collective extensions #9389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/docs/reference/contextual/extension-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ a single extension and enclose all methods in braces or an indented region follo
Example:

```scala
extension (ss: Seq[String])
extension (ss: Seq[String]):

def longestStrings: Seq[String] =
val maxLength = ss.map(_.length).max
Expand Down Expand Up @@ -130,7 +130,7 @@ extension (ss: Seq[String])
Collective extensions also can take type parameters and have using clauses. Example

```scala
extension [T](xs: List[T])(using Ordering[T])
extension [T](xs: List[T])(using Ordering[T]):
def smallest(n: Int): List[T] = xs.sorted.take(n)
def smallestIndices(n: Int): List[Int] =
val limit = smallest(n).max
Expand Down