Skip to content

Allow parsing of "nonisolated" as a type specifier along with "isolated" #3015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CodeGeneration/Sources/SyntaxSupport/TypeNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ public let TYPE_NODES: [Node] = [
.keyword(.__shared),
.keyword(.__owned),
.keyword(.isolated),
.keyword(.nonisolated),
.keyword(._const),
.keyword(.borrowing),
.keyword(.consuming),
Expand Down
9 changes: 9 additions & 0 deletions Sources/SwiftParser/generated/Parser+TokenSpecSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3503,6 +3503,7 @@ extension SimpleTypeSpecifierSyntax {
case __shared
case __owned
case isolated
case nonisolated
case _const
case borrowing
case consuming
Expand All @@ -3518,6 +3519,8 @@ extension SimpleTypeSpecifierSyntax {
self = .__owned
case TokenSpec(.isolated):
self = .isolated
case TokenSpec(.nonisolated):
self = .nonisolated
case TokenSpec(._const):
self = ._const
case TokenSpec(.borrowing):
Expand All @@ -3541,6 +3544,8 @@ extension SimpleTypeSpecifierSyntax {
self = .__owned
case TokenSpec(.isolated):
self = .isolated
case TokenSpec(.nonisolated):
self = .nonisolated
case TokenSpec(._const):
self = ._const
case TokenSpec(.borrowing):
Expand All @@ -3564,6 +3569,8 @@ extension SimpleTypeSpecifierSyntax {
return .keyword(.__owned)
case .isolated:
return .keyword(.isolated)
case .nonisolated:
return .keyword(.nonisolated)
case ._const:
return .keyword(._const)
case .borrowing:
Expand All @@ -3589,6 +3596,8 @@ extension SimpleTypeSpecifierSyntax {
return .keyword(.__owned)
case .isolated:
return .keyword(.isolated)
case .nonisolated:
return .keyword(.nonisolated)
case ._const:
return .keyword(._const)
case .borrowing:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2591,6 +2591,7 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) {
.keyword("__shared"),
.keyword("__owned"),
.keyword("isolated"),
.keyword("nonisolated"),
.keyword("_const"),
.keyword("borrowing"),
.keyword("consuming"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ public struct SimpleStringLiteralExprSyntax: ExprSyntaxProtocol, SyntaxHashable,
///
/// ### Children
///
/// - `specifier`: (`inout` | `__shared` | `__owned` | `isolated` | `_const` | `borrowing` | `consuming` | `sending`)
/// - `specifier`: (`inout` | `__shared` | `__owned` | `isolated` | `nonisolated` | `_const` | `borrowing` | `consuming` | `sending`)
///
/// ### Contained in
///
Expand Down Expand Up @@ -1351,6 +1351,7 @@ public struct SimpleTypeSpecifierSyntax: SyntaxProtocol, SyntaxHashable, _LeafSy
/// - `__shared`
/// - `__owned`
/// - `isolated`
/// - `nonisolated`
/// - `_const`
/// - `borrowing`
/// - `consuming`
Expand Down
15 changes: 15 additions & 0 deletions Tests/SwiftParserTest/DeclarationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,21 @@ final class DeclarationTests: ParserTestCase {
)
}

func testParseIsolatedConformances() {
assertParse(
"""
extension Int: nonisolated Q {}
"""
)

assertParse(
"""
extension Int: @MainActor P {}
"""
)

}

func testParseDynamicReplacement() {
assertParse(
"""
Expand Down