Skip to content

[6.0.1] Enable the sendingArgsAndResults experimental feature #2839

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
Sep 9, 2024
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
5 changes: 1 addition & 4 deletions CodeGeneration/Sources/SyntaxSupport/KeywordSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -697,10 +697,7 @@ public enum Keyword: CaseIterable {
case .throws:
return KeywordSpec("throws", isLexerClassified: true)
case .sending:
return KeywordSpec(
"sending",
experimentalFeature: .sendingArgsAndResults
)
return KeywordSpec("sending")
case .transpose:
return KeywordSpec("transpose")
case .true:
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftParser/Patterns.swift
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ extension Parser.Lookahead {
&& !self.at(.keyword(.__owned))
&& !self.at(.keyword(.borrowing))
&& !self.at(.keyword(.consuming))
&& !(experimentalFeatures.contains(.sendingArgsAndResults) && self.at(.keyword(.sending)))
&& !self.at(.keyword(.sending))
&& !(experimentalFeatures.contains(.nonescapableTypes) && self.at(.keyword(._resultDependsOn)))
{
return true
Expand Down
10 changes: 2 additions & 8 deletions Sources/SwiftParser/generated/Parser+TokenSpecSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -810,9 +810,6 @@ extension DeclModifierSyntax {
case `static`
case unowned
case weak
#if compiler(>=5.8)
@_spi(ExperimentalLanguageFeatures)
#endif
case sending

init?(lexeme: Lexer.Lexeme, experimentalFeatures: Parser.ExperimentalFeatures) {
Expand Down Expand Up @@ -889,7 +886,7 @@ extension DeclModifierSyntax {
self = .unowned
case TokenSpec(.weak):
self = .weak
case TokenSpec(.sending) where experimentalFeatures.contains(.sendingArgsAndResults):
case TokenSpec(.sending):
self = .sending
default:
return nil
Expand Down Expand Up @@ -3343,9 +3340,6 @@ extension SimpleTypeSpecifierSyntax {
@_spi(ExperimentalLanguageFeatures)
#endif
case _resultDependsOn
#if compiler(>=5.8)
@_spi(ExperimentalLanguageFeatures)
#endif
case sending

init?(lexeme: Lexer.Lexeme, experimentalFeatures: Parser.ExperimentalFeatures) {
Expand All @@ -3366,7 +3360,7 @@ extension SimpleTypeSpecifierSyntax {
self = .consuming
case TokenSpec(._resultDependsOn) where experimentalFeatures.contains(.nonescapableTypes):
self = ._resultDependsOn
case TokenSpec(.sending) where experimentalFeatures.contains(.sendingArgsAndResults):
case TokenSpec(.sending):
self = .sending
default:
return nil
Expand Down
3 changes: 0 additions & 3 deletions Sources/SwiftSyntax/generated/Keyword.swift
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,6 @@ public enum Keyword: UInt8, Hashable, Sendable {
#endif
case scoped
case `self`
#if compiler(>=5.8)
@_spi(ExperimentalLanguageFeatures)
#endif
case sending
case `Self`
case Sendable
Expand Down
15 changes: 3 additions & 12 deletions Tests/SwiftParserTest/DeclarationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3295,17 +3295,8 @@ final class DeclarationTests: ParserTestCase {
}

func testSendingTypeSpecifier() {
assertParse(
"func testVarDeclTupleElt() -> (sending String, String) {}",
experimentalFeatures: .sendingArgsAndResults
)
assertParse(
"func testVarDeclTuple2(_ x: (sending String)) {}",
experimentalFeatures: .sendingArgsAndResults
)
assertParse(
"func testVarDeclTuple2(_ x: (sending String, String)) {}",
experimentalFeatures: .sendingArgsAndResults
)
assertParse("func testVarDeclTupleElt() -> (sending String, String) {}")
assertParse("func testVarDeclTuple2(_ x: (sending String)) {}")
assertParse("func testVarDeclTuple2(_ x: (sending String, String)) {}")
}
}
6 changes: 2 additions & 4 deletions Tests/SwiftParserTest/SendingTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ final class SendingTests: ParserTestCase {
"""
class Klass {}
func transferMain(_ x: sending Klass) -> ()
""",
experimentalFeatures: .sendingArgsAndResults
"""
)
}

Expand All @@ -29,8 +28,7 @@ final class SendingTests: ParserTestCase {
"""
class Klass {}
func transferMain(_ y: Klass, _ x: sending Klass, _ z: Klass) -> ()
""",
experimentalFeatures: .sendingArgsAndResults
"""
)
}
}