You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/Sema/coroutine_accessors.swift
+24-24Lines changed: 24 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -33,17 +33,16 @@ var ingnsn_m: Int {
33
33
varignsn_m:Int{
34
34
mutating get{0}
35
35
nonmutating set{}
36
-
// FIXME: Bad diagnostic! The writer is non-mutating--the reader is mutating.
37
-
nonmutating _modify{ // expected-error{{'modify' accessor cannot be 'nonmutating' when the setter is 'mutating'}}
38
-
// expected-note@-3{{setter defined here}}
36
+
nonmutating _modify{ // expected-error{{'modify' accessor cannot be 'nonmutating' when the getter is 'mutating'}}
37
+
// expected-note@-3{{getter defined here}}
39
38
varfake:Int
40
39
yield &fake
41
40
}
42
41
}
43
42
varingsn_m:Int{
44
43
get{0}
45
44
set{}
46
-
nonmutating _modify{ // expected-error{{'modify' accessor cannot be 'nonmutating' when the setter is 'mutating'}}
45
+
nonmutating _modify{ // expected-error{{'modify' accessor cannot be 'nonmutating' when the setter is not 'nonmutating'}}
47
46
// expected-note@-2{{setter defined here}}
48
47
varfake:Int
49
48
yield &fake
@@ -52,18 +51,19 @@ var ingsn_m: Int {
52
51
varigsn_m:Int{
53
52
mutating get{0}
54
53
set{}
55
-
// TODO: Incomplete diagnostic! Both the writer AND the reader are mutating.
56
-
nonmutating _modify{ // expected-error{{'modify' accessor cannot be 'nonmutating' when the setter is 'mutating'}}
57
-
// expected-note@-3{{setter defined here}}
54
+
nonmutating _modify{ // expected-error{{'modify' accessor cannot be 'nonmutating' when either the setter is not 'nonmutating' or the getter is 'mutating'}}
55
+
// expected-note@-2{{setter defined here}}
56
+
// expected-note@-4{{getter defined here}}
58
57
varfake:Int
59
58
yield &fake
60
59
}
61
60
}
62
61
varingns_m:Int{
63
62
get{0}
64
63
nonmutating set{}
65
-
_modify{ // expected-error{{'modify' accessor cannot be 'mutating' when the setter is 'nonmutating'}}
64
+
_modify{ // expected-error{{'modify' accessor cannot be 'mutating' when both the setter is 'nonmutating' and the getter is not 'mutating'}}
66
65
// expected-note@-2{{setter defined here}}
66
+
// expected-note@-4{{getter defined here}}
67
67
yield &i
68
68
}
69
69
}
@@ -115,17 +115,16 @@ var in_rnsn_m: Int {
115
115
vari_rnsn_m:Int{
116
116
mutating _read { yield i }
117
117
nonmutating set{}
118
-
// FIXME: Bad diagnostic! The writer is non-mutating--the reader is mutating.
119
-
nonmutating _modify{ // expected-error{{'modify' accessor cannot be 'nonmutating' when the setter is 'mutating'}}
120
-
// expected-note@-3{{setter defined here}}
118
+
nonmutating _modify{ // expected-error{{'modify' accessor cannot be 'nonmutating' when the 'read' accessor is 'mutating'}}
119
+
// expected-note@-3{{'read' accessor defined here}}
121
120
varfake:Int
122
121
yield &fake
123
122
}
124
123
}
125
124
varin_rsn_m:Int{
126
125
_read{ yield i }
127
126
set{}
128
-
nonmutating _modify { // expected-error{{'modify' accessor cannot be 'nonmutating' when the setter is 'mutating'}}
127
+
nonmutating _modify { // expected-error{{'modify' accessor cannot be 'nonmutating' when the setter is not 'nonmutating'}}
129
128
// expected-note@-2{{setter defined here}}
130
129
varfake:Int
131
130
yield &fake
@@ -134,18 +133,19 @@ var in_rsn_m: Int {
134
133
vari_rsn_m:Int{
135
134
mutating _read { yield i }
136
135
set{}
137
-
// TODO: Incomplete diagnostic! Both the writer AND the reader are mutating.
138
-
nonmutating _modify { // expected-error{{'modify' accessor cannot be 'nonmutating' when the setter is 'mutating'}}
139
-
// expected-note@-3{{setter defined here}}
136
+
nonmutating _modify { // expected-error{{'modify' accessor cannot be 'nonmutating' when either the setter is not 'nonmutating' or the 'read' accessor is 'mutating'}}
137
+
// expected-note@-2{{setter defined here}}
138
+
// expected-note@-4{{'read' accessor defined here}}
140
139
varfake:Int
141
140
yield &fake
142
141
}
143
142
}
144
143
varin_rns_m:Int{
145
144
_read{ yield i }
146
145
nonmutating set {}
147
-
_modify{ // expected-error{{'modify' accessor cannot be 'mutating' when the setter is 'nonmutating'}}
146
+
_modify{ // expected-error{{'modify' accessor cannot be 'mutating' when both the setter is 'nonmutating' and the 'read' accessor is not 'mutating'}}
148
147
// expected-note@-2{{setter defined here}}
148
+
// expected-note@-4{{'read' accessor defined here}}
// TODO: Incomplete diagnostic! Both the writer AND the reader are mutating.
220
-
nonmutating _modify { // expected-error{{'modify' accessor cannot be 'nonmutating' when the setter is 'mutating'}}
221
-
// expected-note@-3{{setter defined here}}
218
+
nonmutating _modify { // expected-error{{'modify' accessor cannot be 'nonmutating' when either the setter is not 'nonmutating' or the addressor is 'mutating'}}
219
+
// expected-note@-2{{setter defined here}}
220
+
// expected-note@-4{{addressor defined here}}
222
221
varfake:Int
223
222
yield &fake
224
223
}
225
224
}
226
225
varinuans_m:Int{
227
226
unsafeAddress{UnsafePointer(bitPattern:0x0)! }
228
227
nonmutating set {}
229
-
_modify{ // expected-error{{'modify' accessor cannot be 'mutating' when the setter is 'nonmutating'}}
228
+
_modify{ // expected-error{{'modify' accessor cannot be 'mutating' when both the setter is 'nonmutating' and the addressor is not 'mutating'}}
0 commit comments