Skip to content

confusing doc page on option-less pattern matching - strange implicit in unapply example #16131

Closed
@bjornregnell

Description

@bjornregnell

Problem

In this document page:
https://github.com/lampepfl/dotty/blob/main/docs/_docs/reference/changed-features/pattern-matching.md

The initial definition of what an extractor is says that it is a an object having a special unapply looking like this:

def unapply[A](x: T)(implicit x: B): U
def unapplySeq[A](x: T)(implicit x: B): U

Why is there an (implicit x: B) ? And what is U?

The doc page never explains it and I can't find any place in the examples further down where the mystic implicit of type B is used. And if it must be there, should this not be a using as this is Scala 3?

Proposal

If the implicit is there just to illustrate that there can be an implicit then I think it is better to remove it and just state in the text that a using-parameter is allowed.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions