@@ -16,7 +16,7 @@ def unapply[A](x: T)(implicit x: B): U
16
16
def unapplySeq [A ](x : T )(implicit x : B ): U
17
17
```
18
18
19
- Extractors expose the method ` unapply ` are called fix -arity extractors, which
19
+ Extractors expose the method ` unapply ` are called fixed -arity extractors, which
20
20
work with patterns of fixed arity. Extractors expose the method ` unapplySeq ` are
21
21
called variadic extractors, which enables variadic patterns.
22
22
@@ -44,9 +44,11 @@ type R = {
44
44
45
45
and ` S ` conforms to one of the following matches:
46
46
47
- - Single match
48
- - Name -based match
47
+ - single match
48
+ - name -based match
49
49
50
+ The former form of ` unapply ` has higher precedence, and _ single match_ has higher
51
+ precedence over _ name-based match_ .
50
52
51
53
### Variadic Extractors
52
54
@@ -58,8 +60,8 @@ def unapplySeq[A](x: T)(implicit x: B): U
58
60
59
61
The type ` U ` conforms to one of the following matches:
60
62
61
- - Sequence match
62
- - Product -sequence match
63
+ - sequence match
64
+ - product -sequence match
63
65
64
66
Or ` U ` conforms to the type ` R ` :
65
67
@@ -72,6 +74,9 @@ type R = {
72
74
73
75
and ` S ` conforms to one of the two matches above.
74
76
77
+ The former form of ` unapplySeq ` has higher priority, and _ sequence match_ has higher
78
+ precedence over _ product-sequence match_ .
79
+
75
80
## Boolean Match
76
81
77
82
- ` U =:= Boolean `
@@ -169,7 +174,7 @@ object ProdEmpty {
169
174
```
170
175
171
176
172
- ## Seq Match
177
+ ## Sequence Match
173
178
174
179
- ` U <: X ` , ` T2 ` and ` T3 ` conform to ` T1 `
175
180
@@ -201,7 +206,7 @@ object CharList {
201
206
// e,x,a,m
202
207
```
203
208
204
- ## Product-Seq Match
209
+ ## Product-Sequence Match
205
210
206
211
- ` U <: Product `
207
212
- ` N > 0 ` is the maximum number of consecutive (parameterless ` def ` or ` val ` ) ` _1: P1 ` ... ` _N: PN ` members in ` U `
@@ -221,5 +226,5 @@ def foo(f: Foo) = f match {
221
226
}
222
227
```
223
228
224
- There are plans for further simplification, in particular to factor out * Product
225
- Pattern * and * Name Based Pattern * into a single type of extractor.
229
+ There are plans for further simplification, in particular to factor out * product
230
+ match * and * name-based match * into a single type of extractor.
0 commit comments