@@ -67,7 +67,7 @@ expression:
67
67
68
68
For example, given the following copyable definition:
69
69
70
- ```
70
+ ``` swift
71
71
enum CopyableEnum {
72
72
case foo (Int )
73
73
case bar (Int , String )
@@ -76,15 +76,15 @@ enum CopyableEnum {
76
76
77
77
then the following patterns have ownership behavior as indicated below:
78
78
79
- ```
79
+ ``` swift
80
80
case let x: // copying
81
81
case .foo (let x): // copying
82
82
case .bar (let x, let y): // copying
83
83
```
84
84
85
85
And for a noncopyable enum definition:
86
86
87
- ```
87
+ ``` swift
88
88
struct NC : ~ Copyable {}
89
89
90
90
enum NoncopyableEnum : ~ Copyable {
@@ -95,7 +95,7 @@ enum NoncopyableEnum: ~Copyable {
95
95
96
96
then the following patterns have ownership behavior as indicated below:
97
97
98
- ```
98
+ ``` swift
99
99
var foo: NoncopyableEnum // stored variable
100
100
101
101
switch foo {
@@ -136,7 +136,7 @@ consuming the value to form variable bindings. Matching enum cases and tuples
136
136
(when noncopyable tuples are supported) for instance is still possible
137
137
even if they contain consuming ` let ` or ` var ` bindings as subpatterns:
138
138
139
- ```
139
+ ``` swift
140
140
extension Handle {
141
141
var isReady: Bool { ... }
142
142
}
@@ -153,10 +153,10 @@ case .foo(let y):
153
153
```
154
154
155
155
However, when a pattern has a ` where ` clause, variable bindings cannot be
156
- consumed in the where clause even if the binding is consumable in the case
156
+ consumed in the ` where ` clause even if the binding is consumable in the ` case `
157
157
body:
158
158
159
- ```
159
+ ``` swift
160
160
extension Handle {
161
161
consuming func tryClose () -> Bool { ... }
162
162
}
@@ -175,7 +175,7 @@ case .foo(let y):
175
175
Similarly, an expression subpattern whose ` ~= ` operator consumes the subject
176
176
cannot be used to test a noncopyable subpattern.
177
177
178
- ```
178
+ ``` swift
179
179
extension Handle {
180
180
static func ~= (identifier : Int , handle : consuming Handle) -> Bool { ... }
181
181
}
@@ -291,7 +291,7 @@ could be used in the future to explicitly mark the subject of a switch as
291
291
being borrowed, even if it is normally copyable or would be a consumable
292
292
temporary, as in:
293
293
294
- ```
294
+ ``` swift
295
295
let x: String ? = " hello"
296
296
297
297
switch borrow x {
0 commit comments