Commit 16c4014
committed
[SwiftParser] Update whitespace rule between attribute name and '('
In Swift 6 and later, whitespace is no longer permitted between an
attribute name and the opening parenthesis. Update the parser so that in
Swift 6+, a '(' without preceding whitespace is always treated as the
start of the argument list, while a '(' with preceding whitespace is
considered the start of the argument list only when it is unambiguous.
This change makes the following closure be parsed correctly:
```swift
{ @mainactor (arg: Int) in ... }
```
rdar://1477855441 parent 6df106d commit 16c4014
File tree
7 files changed
+196
-115
lines changed- Sources/SwiftParser
- Tests/SwiftParserTest
7 files changed
+196
-115
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
| 200 | + | |
199 | 201 | | |
200 | 202 | | |
201 | 203 | | |
202 | 204 | | |
203 | 205 | | |
204 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
205 | 209 | | |
206 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
207 | 213 | | |
208 | 214 | | |
209 | 215 | | |
210 | 216 | | |
211 | 217 | | |
212 | | - | |
213 | | - | |
214 | | - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
215 | 221 | | |
216 | 222 | | |
217 | 223 | | |
218 | 224 | | |
219 | 225 | | |
220 | 226 | | |
| 227 | + | |
221 | 228 | | |
222 | 229 | | |
223 | 230 | | |
| |||
1074 | 1081 | | |
1075 | 1082 | | |
1076 | 1083 | | |
1077 | | - | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
1078 | 1088 | | |
1079 | 1089 | | |
1080 | 1090 | | |
1081 | 1091 | | |
1082 | | - | |
1083 | | - | |
1084 | | - | |
1085 | | - | |
1086 | | - | |
1087 | | - | |
1088 | | - | |
1089 | | - | |
1090 | | - | |
1091 | | - | |
1092 | | - | |
1093 | | - | |
1094 | | - | |
1095 | | - | |
1096 | | - | |
1097 | | - | |
1098 | | - | |
1099 | | - | |
1100 | | - | |
1101 | | - | |
1102 | | - | |
1103 | | - | |
1104 | | - | |
1105 | | - | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
1106 | 1130 | | |
1107 | 1131 | | |
1108 | 1132 | | |
1109 | 1133 | | |
1110 | | - | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
1111 | 1138 | | |
1112 | 1139 | | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
1113 | 1146 | | |
1114 | | - | |
| 1147 | + | |
1115 | 1148 | | |
1116 | 1149 | | |
1117 | 1150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | 54 | | |
61 | 55 | | |
62 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
174 | | - | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
178 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
179 | 181 | | |
180 | 182 | | |
181 | 183 | | |
182 | 184 | | |
183 | 185 | | |
184 | 186 | | |
185 | 187 | | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | 188 | | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
| 189 | + | |
| 190 | + | |
200 | 191 | | |
201 | 192 | | |
202 | 193 | | |
| |||
212 | 203 | | |
213 | 204 | | |
214 | 205 | | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
227 | 209 | | |
228 | 210 | | |
229 | 211 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
258 | 262 | | |
259 | 263 | | |
260 | 264 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
790 | 790 | | |
791 | 791 | | |
792 | 792 | | |
| 793 | + | |
793 | 794 | | |
794 | 795 | | |
795 | 796 | | |
| |||
798 | 799 | | |
799 | 800 | | |
800 | 801 | | |
801 | | - | |
| 802 | + | |
802 | 803 | | |
803 | 804 | | |
804 | 805 | | |
| |||
817 | 818 | | |
818 | 819 | | |
819 | 820 | | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | | - | |
| 821 | + | |
825 | 822 | | |
826 | 823 | | |
827 | 824 | | |
| |||
1186 | 1183 | | |
1187 | 1184 | | |
1188 | 1185 | | |
1189 | | - | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
1190 | 1189 | | |
1191 | 1190 | | |
1192 | 1191 | | |
| |||
1214 | 1213 | | |
1215 | 1214 | | |
1216 | 1215 | | |
1217 | | - | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
1218 | 1220 | | |
1219 | | - | |
1220 | | - | |
1221 | | - | |
1222 | | - | |
1223 | 1221 | | |
1224 | | - | |
1225 | | - | |
1226 | | - | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
1227 | 1228 | | |
1228 | 1229 | | |
1229 | 1230 | | |
| |||
1233 | 1234 | | |
1234 | 1235 | | |
1235 | 1236 | | |
1236 | | - | |
1237 | 1237 | | |
1238 | 1238 | | |
1239 | | - | |
1240 | | - | |
1241 | | - | |
1242 | | - | |
1243 | | - | |
1244 | | - | |
1245 | | - | |
1246 | | - | |
1247 | | - | |
1248 | | - | |
1249 | | - | |
1250 | | - | |
1251 | | - | |
1252 | | - | |
1253 | | - | |
1254 | | - | |
1255 | | - | |
1256 | | - | |
1257 | | - | |
1258 | | - | |
1259 | | - | |
1260 | | - | |
1261 | 1239 | | |
1262 | 1240 | | |
1263 | 1241 | | |
| |||
0 commit comments