@@ -36,6 +36,7 @@ enum TokenPrecedence: Comparable {
36
36
case weakBracketClose
37
37
/// Keywords that start a new statement.
38
38
case stmtKeyword
39
+ case typeKeyword
39
40
case declarationAttributeWithSpecialSyntax
40
41
/// The '{' token because it typically marks the body of a declaration.
41
42
/// `closingDelimiter` must have type `strongPunctuator`
@@ -83,20 +84,22 @@ enum TokenPrecedence: Comparable {
83
84
return 6
84
85
case . stmtKeyword:
85
86
return 7
86
- case . declarationAttributeWithSpecialSyntax :
87
+ case . typeKeyword :
87
88
return 8
88
- case . strongPunctuator :
89
+ case . declarationAttributeWithSpecialSyntax :
89
90
return 9
90
- case . openingBrace :
91
+ case . strongPunctuator :
91
92
return 10
92
- case . closingBrace :
93
+ case . openingBrace :
93
94
return 11
94
- case . declKeyword :
95
+ case . closingBrace :
95
96
return 12
96
- case . openingPoundIf :
97
+ case . declKeyword :
97
98
return 13
98
- case . closingPoundIf :
99
+ case . openingPoundIf :
99
100
return 14
101
+ case . closingPoundIf:
102
+ return 15
100
103
}
101
104
}
102
105
@@ -276,6 +279,21 @@ enum TokenPrecedence: Comparable {
276
279
. transpose:
277
280
self = . declarationAttributeWithSpecialSyntax
278
281
282
+ case // `TypeAttribute`
283
+ . _local,
284
+ . _noMetadata,
285
+ . _opaqueReturnTypeOf,
286
+ . async ,
287
+ . autoclosure,
288
+ . convention,
289
+ . differentiable,
290
+ . escaping,
291
+ . noDerivative,
292
+ . noescape,
293
+ . Sendable,
294
+ . unchecked:
295
+ self = . typeKeyword
296
+
279
297
case // Treat all other keywords as expression keywords in the absence of any better information.
280
298
. __owned,
281
299
. __shared,
@@ -287,8 +305,6 @@ enum TokenPrecedence: Comparable {
287
305
. _move,
288
306
. _NativeClass,
289
307
. _NativeRefCountedObject,
290
- . _noMetadata,
291
- . _opaqueReturnTypeOf,
292
308
. _PackageDescription,
293
309
. _RefCountedObject,
294
310
. _Trivial,
@@ -300,16 +316,13 @@ enum TokenPrecedence: Comparable {
300
316
. any,
301
317
. assignment,
302
318
. associativity,
303
- . autoclosure,
304
319
. availability,
305
320
. before,
306
321
. block,
307
322
. canImport,
308
323
. compiler,
309
- . convention,
310
324
. cType,
311
325
. deprecated,
312
- . escaping,
313
326
. exported,
314
327
. file,
315
328
. discard,
@@ -326,8 +339,6 @@ enum TokenPrecedence: Comparable {
326
339
. metadata,
327
340
. module,
328
341
. noasync,
329
- . noDerivative,
330
- . noescape,
331
342
. none,
332
343
. obsoleted,
333
344
. of,
@@ -336,15 +347,13 @@ enum TokenPrecedence: Comparable {
336
347
. reverse,
337
348
. right,
338
349
. safe,
339
- . Sendable,
340
350
. sourceFile,
341
351
. spi,
342
352
. spiModule,
343
353
. swift,
344
354
. target,
345
355
. Type,
346
356
. unavailable,
347
- . unchecked,
348
357
. unowned,
349
358
. visibility,
350
359
. weak,
0 commit comments