@@ -100,6 +100,7 @@ extension Parser {
100100 RawAttributedTypeSyntax (
101101 specifiers: specifiersAndAttributes. specifiers,
102102 attributes: specifiersAndAttributes. attributes,
103+ lateSpecifiers: specifiersAndAttributes. lateSpecifiers,
103104 baseType: base,
104105 arena: self . arena
105106 )
@@ -1215,7 +1216,8 @@ extension Parser {
12151216 misplacedSpecifiers: [ RawTokenSyntax ] = [ ]
12161217 ) -> (
12171218 specifiers: RawTypeSpecifierListSyntax ,
1218- attributes: RawAttributeListSyntax
1219+ attributes: RawAttributeListSyntax ,
1220+ lateSpecifiers: RawTypeSpecifierListSyntax
12191221 ) ? {
12201222 var specifiers : [ RawTypeSpecifierListSyntax . Element ] = [ ]
12211223 SPECIFIER_PARSING: while canHaveParameterSpecifier {
@@ -1254,7 +1256,15 @@ extension Parser {
12541256 attributes = nil
12551257 }
12561258
1257- guard !specifiers. isEmpty || attributes != nil else {
1259+ // Only handle `nonisolated` as a late specifier.
1260+ var lateSpecifiers : [ RawTypeSpecifierListSyntax . Element ] = [ ]
1261+ if self . at ( . keyword( . nonisolated) ) && !( self . peek ( isAt: . leftParen) && self . peek ( ) . isAtStartOfLine)
1262+ && canHaveParameterSpecifier
1263+ {
1264+ lateSpecifiers. append ( parseNonisolatedTypeSpecifier ( ) )
1265+ }
1266+
1267+ guard !specifiers. isEmpty || attributes != nil || !lateSpecifiers. isEmpty else {
12581268 // No specifiers or attributes on this type
12591269 return nil
12601270 }
@@ -1265,9 +1275,17 @@ extension Parser {
12651275 specifierList = RawTypeSpecifierListSyntax ( elements: specifiers, arena: arena)
12661276 }
12671277
1278+ let lateSpecifierList : RawTypeSpecifierListSyntax
1279+ if lateSpecifiers. isEmpty {
1280+ lateSpecifierList = self . emptyCollection ( RawTypeSpecifierListSyntax . self)
1281+ } else {
1282+ lateSpecifierList = RawTypeSpecifierListSyntax ( elements: lateSpecifiers, arena: arena)
1283+ }
1284+
12681285 return (
12691286 specifierList,
1270- attributes ?? self . emptyCollection ( RawAttributeListSyntax . self)
1287+ attributes ?? self . emptyCollection ( RawAttributeListSyntax . self) ,
1288+ lateSpecifierList
12711289 )
12721290 }
12731291
0 commit comments