@@ -12,7 +12,7 @@ Scala 3 supports a superset of Scala 2 [extractors](https://www.scala-lang.org/f
12
12
13
13
Extractors are objects that expose a method ` unapply ` or ` unapplySeq ` :
14
14
15
- ``` Scala
15
+ ``` scala
16
16
def unapply [A ](x : T )(implicit x : B ): U
17
17
def unapplySeq [A ](x : T )(implicit x : B ): U
18
18
```
@@ -25,7 +25,7 @@ called variadic extractors, which enables variadic patterns.
25
25
26
26
Fixed-arity extractors expose the following signature:
27
27
28
- ``` Scala
28
+ ``` scala
29
29
def unapply [A ](x : T )(implicit x : B ): U
30
30
```
31
31
@@ -36,7 +36,7 @@ The type `U` conforms to one of the following matches:
36
36
37
37
Or ` U ` conforms to the type ` R ` :
38
38
39
- ``` Scala
39
+ ``` scala
40
40
type R = {
41
41
def isEmpty : Boolean
42
42
def get : S
@@ -62,7 +62,7 @@ A usage of a fixed-arity extractor is irrefutable if one of the following condit
62
62
63
63
Variadic extractors expose the following signature:
64
64
65
- ``` Scala
65
+ ``` scala
66
66
def unapplySeq [A ](x : T )(implicit x : B ): U
67
67
```
68
68
@@ -73,7 +73,7 @@ The type `U` conforms to one of the following matches:
73
73
74
74
Or ` U ` conforms to the type ` R ` :
75
75
76
- ``` Scala
76
+ ``` scala
77
77
type R = {
78
78
def isEmpty : Boolean
79
79
def get : S
@@ -167,7 +167,7 @@ object Nat:
167
167
- ` N > 1 ` is the maximum number of consecutive (parameterless ` def ` or ` val ` ) ` _1: P1 ... _N: PN ` members in ` U `
168
168
- Pattern-matching on exactly ` N ` patterns with types ` P1, P2, ..., PN `
169
169
170
- ``` Scala
170
+ ``` scala
171
171
object ProdEmpty :
172
172
def _1 : Int = ???
173
173
def _2 : String = ???
@@ -184,7 +184,7 @@ object ProdEmpty:
184
184
185
185
- ` U <: X ` , ` T2 ` and ` T3 ` conform to ` T1 `
186
186
187
- ``` Scala
187
+ ``` scala
188
188
type X = {
189
189
def lengthCompare (len : Int ): Int // or, `def length: Int`
190
190
def apply (i : Int ): T1
@@ -219,7 +219,7 @@ object CharList:
219
219
- Pattern-matching on exactly ` >= N ` patterns, the first ` N - 1 ` patterns have types ` P1, P2, ... P(N-1) ` ,
220
220
the type of the remaining patterns are determined as in Seq Pattern.
221
221
222
- ``` Scala
222
+ ``` scala
223
223
class Foo (val name : String , val children : Int * )
224
224
object Foo :
225
225
def unapplySeq (f : Foo ): Option [(String , Seq [Int ])] =
0 commit comments