Skip to content

Commit

Permalink
Merge pull request #2837 from ahoppen/6.0/enable-sending-arg
Browse files Browse the repository at this point in the history
[6.0] Enable the `sendingArgsAndResults` experimental feature
  • Loading branch information
ahoppen authored Sep 7, 2024
2 parents 515f79b + 7aa2516 commit cb53fa1
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 32 deletions.
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
"""
)
}
}

0 comments on commit cb53fa1

Please sign in to comment.