Skip to content
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

Update pattern-matching.md #20594

Open
wants to merge 1 commit into
base: language-reference-stable
Choose a base branch
from
Open
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
14 changes: 7 additions & 7 deletions docs/_docs/reference/changed-features/pattern-matching.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def unapplySeq(x: T): U
```

Where `T` is an arbitrary type, if it is a subtype of the scrutinee's type `Scrut`, a [type test](../other-new-features/type-test.md) is performed before calling the method.
`U` follows rules described in [Fixed Arity Extractors](#fixed-arity-extractors) and [Variadic Extractors](#variadic-extractors).
`U` follows rules described in [Fixed Arity Extractors](#fixed-arity-extractors-1) and [Variadic Extractors](#variadic-extractors-1).

**Note:** `U` can be the type of the extractor object.

Expand All @@ -43,8 +43,8 @@ def unapply(x: T): U

The type `U` conforms to one of the following matches:

- [Boolean match](#boolean-match)
- [Product match](#product-match)
- [Boolean match](#boolean-match-1)
- [Product match](#product-match-1)

Or `U` conforms to the type `R`:

Expand All @@ -57,8 +57,8 @@ type R = {

and `S` conforms to one of the following matches:

- [single match](#single-match)
- [name-based match](#name-based-match)
- [single match](#single-match-1)
- [name-based match](#name-based-match-1)

The former form of `unapply` has higher precedence, and _single match_ has higher
precedence over _name-based match_.
Expand Down Expand Up @@ -183,8 +183,8 @@ Where `U` has to fullfill the following:

1. Set `V := U`
2. `V` is valid if `V` conforms to one of the following matches:
- [sequence match](#sequence-match)
- [product-sequence match](#product-sequence-match)
- [sequence match](#sequence-match-1)
- [product-sequence match](#product-sequence-match-1)
3. Otherwise `U` has to conform to the type `R`:
```scala
type R = {
Expand Down
Loading