Skip to content

Documentation mistakes: listOrd in delegates.md and operators in extension-methods.md #7576

Closed
@rpiotrow

Description

@rpiotrow

I think I have found two mistakes in documentation.

  1. In https://github.com/lampepfl/dotty/blob/master/docs/docs/reference/contextual/delegates.md in implementation of listOrd there is:
  def compare(xs: List[T], ys: List[T]): Int = (xs, ys) match {
    [...]
    case (x :: xs1, y :: ys1) =>
      val fst = ord.compare(x, y)
      if (fst != 0) fst else xs1.compareTo(ys1)
  }

but should be:

  def compare(xs: List[T], ys: List[T]): Int = (xs, ys) match {
    [...]
    case (x :: xs1, y :: ys1) =>
      val fst = ord.compare(x, y)
      if (fst != 0) fst else compare(xs1, ys1)
  }
  1. In https://github.com/lampepfl/dotty/blob/master/docs/docs/reference/contextual/extension-methods.md#operators there is:
def (x: String) < (y: String) = ...
def (x: Elem) +: (xs: Seq[Elem]) = ...

"ab" + "c"
1 +: List(2, 3)

but should be:

def (x: String) < (y: String) = ...
def (x: Elem) +: (xs: Seq[Elem]) = ...

"ab" < "c"
1 +: List(2, 3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions