Skip to content

Commit 871be87

Browse files
committed
Allow parsing of "nonisolated" as a type specifier along with "isolated"
This is used for isolated conformances.
1 parent 50ca735 commit 871be87

File tree

5 files changed

+28
-1
lines changed

5 files changed

+28
-1
lines changed

CodeGeneration/Sources/SyntaxSupport/TypeNodes.swift

+1
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ public let TYPE_NODES: [Node] = [
648648
.keyword(.__shared),
649649
.keyword(.__owned),
650650
.keyword(.isolated),
651+
.keyword(.nonisolated),
651652
.keyword(._const),
652653
.keyword(.borrowing),
653654
.keyword(.consuming),

Sources/SwiftParser/generated/Parser+TokenSpecSet.swift

+9
Original file line numberDiff line numberDiff line change
@@ -3503,6 +3503,7 @@ extension SimpleTypeSpecifierSyntax {
35033503
case __shared
35043504
case __owned
35053505
case isolated
3506+
case nonisolated
35063507
case _const
35073508
case borrowing
35083509
case consuming
@@ -3518,6 +3519,8 @@ extension SimpleTypeSpecifierSyntax {
35183519
self = .__owned
35193520
case TokenSpec(.isolated):
35203521
self = .isolated
3522+
case TokenSpec(.nonisolated):
3523+
self = .nonisolated
35213524
case TokenSpec(._const):
35223525
self = ._const
35233526
case TokenSpec(.borrowing):
@@ -3541,6 +3544,8 @@ extension SimpleTypeSpecifierSyntax {
35413544
self = .__owned
35423545
case TokenSpec(.isolated):
35433546
self = .isolated
3547+
case TokenSpec(.nonisolated):
3548+
self = .nonisolated
35443549
case TokenSpec(._const):
35453550
self = ._const
35463551
case TokenSpec(.borrowing):
@@ -3564,6 +3569,8 @@ extension SimpleTypeSpecifierSyntax {
35643569
return .keyword(.__owned)
35653570
case .isolated:
35663571
return .keyword(.isolated)
3572+
case .nonisolated:
3573+
return .keyword(.nonisolated)
35673574
case ._const:
35683575
return .keyword(._const)
35693576
case .borrowing:
@@ -3589,6 +3596,8 @@ extension SimpleTypeSpecifierSyntax {
35893596
return .keyword(.__owned)
35903597
case .isolated:
35913598
return .keyword(.isolated)
3599+
case .nonisolated:
3600+
return .keyword(.nonisolated)
35923601
case ._const:
35933602
return .keyword(._const)
35943603
case .borrowing:

Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift

+1
Original file line numberDiff line numberDiff line change
@@ -2591,6 +2591,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) {
25912591
.keyword("__shared"),
25922592
.keyword("__owned"),
25932593
.keyword("isolated"),
2594+
.keyword("nonisolated"),
25942595
.keyword("_const"),
25952596
.keyword("borrowing"),
25962597
.keyword("consuming"),

Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesQRS.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,7 @@ public struct SimpleStringLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable,
12871287
///
12881288
/// ### Children
12891289
///
1290-
/// - `specifier`: (`inout` | `__shared` | `__owned` | `isolated` | `_const` | `borrowing` | `consuming` | `sending`)
1290+
/// - `specifier`: (`inout` | `__shared` | `__owned` | `isolated` | `nonisolated` | `_const` | `borrowing` | `consuming` | `sending`)
12911291
///
12921292
/// ### Contained in
12931293
///
@@ -1351,6 +1351,7 @@ public struct SimpleTypeSpecifierSyntax: SyntaxProtocol, SyntaxHashable, _LeafSy
13511351
/// - `__shared`
13521352
/// - `__owned`
13531353
/// - `isolated`
1354+
/// - `nonisolated`
13541355
/// - `_const`
13551356
/// - `borrowing`
13561357
/// - `consuming`

Tests/SwiftParserTest/DeclarationTests.swift

+15
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,21 @@ final class DeclarationTests: ParserTestCase {
765765
)
766766
}
767767

768+
func testParseIsolatedConformances() {
769+
assertParse(
770+
"""
771+
extension Int: nonisolated Q {}
772+
"""
773+
)
774+
775+
assertParse(
776+
"""
777+
extension Int: @MainActor P {}
778+
"""
779+
)
780+
781+
}
782+
768783
func testParseDynamicReplacement() {
769784
assertParse(
770785
"""

0 commit comments

Comments
 (0)