Skip to content

Commit 445486b

Browse files
authored
Merge pull request #2835 from ahoppen/enable-sending-arg
Enable the `sendingArgsAndResults` experimental feature
2 parents a3e1604 + fd0b691 commit 445486b

File tree

8 files changed

+9
-38
lines changed

8 files changed

+9
-38
lines changed

CodeGeneration/Sources/SyntaxSupport/ExperimentalFeatures.swift

-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public enum ExperimentalFeature: String, CaseIterable {
1818
case doExpressions
1919
case nonescapableTypes
2020
case trailingComma
21-
case sendingArgsAndResults
2221

2322
/// The name of the feature, which is used in the doc comment.
2423
public var featureName: String {
@@ -33,8 +32,6 @@ public enum ExperimentalFeature: String, CaseIterable {
3332
return "NonEscableTypes"
3433
case .trailingComma:
3534
return "trailing comma"
36-
case .sendingArgsAndResults:
37-
return "SendingArgsAndResults"
3835
}
3936
}
4037

CodeGeneration/Sources/SyntaxSupport/KeywordSpec.swift

+1-4
Original file line numberDiff line numberDiff line change
@@ -687,10 +687,7 @@ public enum Keyword: CaseIterable {
687687
case .throws:
688688
return KeywordSpec("throws", isLexerClassified: true)
689689
case .sending:
690-
return KeywordSpec(
691-
"sending",
692-
experimentalFeature: .sendingArgsAndResults
693-
)
690+
return KeywordSpec("sending")
694691
case .transpose:
695692
return KeywordSpec("transpose")
696693
case .true:

Sources/SwiftParser/Patterns.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ extension Parser.Lookahead {
377377
&& !self.at(.keyword(._const))
378378
&& !self.at(.keyword(.borrowing))
379379
&& !self.at(.keyword(.consuming))
380-
&& !(experimentalFeatures.contains(.sendingArgsAndResults) && self.at(.keyword(.sending)))
380+
&& !self.at(.keyword(.sending))
381381
{
382382
return true
383383
}

Sources/SwiftParser/generated/ExperimentalFeatures.swift

-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,4 @@ extension Parser.ExperimentalFeatures {
3838

3939
/// Whether to enable the parsing of trailing comma.
4040
public static let trailingComma = Self (rawValue: 1 << 4)
41-
42-
/// Whether to enable the parsing of SendingArgsAndResults.
43-
public static let sendingArgsAndResults = Self (rawValue: 1 << 5)
4441
}

Sources/SwiftParser/generated/Parser+TokenSpecSet.swift

+2-8
Original file line numberDiff line numberDiff line change
@@ -858,9 +858,6 @@ extension DeclModifierSyntax {
858858
case `static`
859859
case unowned
860860
case weak
861-
#if compiler(>=5.8)
862-
@_spi(ExperimentalLanguageFeatures)
863-
#endif
864861
case sending
865862

866863
init?(lexeme: Lexer.Lexeme, experimentalFeatures: Parser.ExperimentalFeatures) {
@@ -935,7 +932,7 @@ extension DeclModifierSyntax {
935932
self = .unowned
936933
case TokenSpec(.weak):
937934
self = .weak
938-
case TokenSpec(.sending) where experimentalFeatures.contains(.sendingArgsAndResults):
935+
case TokenSpec(.sending):
939936
self = .sending
940937
default:
941938
return nil
@@ -3431,9 +3428,6 @@ extension SimpleTypeSpecifierSyntax {
34313428
case _const
34323429
case borrowing
34333430
case consuming
3434-
#if compiler(>=5.8)
3435-
@_spi(ExperimentalLanguageFeatures)
3436-
#endif
34373431
case sending
34383432

34393433
init?(lexeme: Lexer.Lexeme, experimentalFeatures: Parser.ExperimentalFeatures) {
@@ -3452,7 +3446,7 @@ extension SimpleTypeSpecifierSyntax {
34523446
self = .borrowing
34533447
case TokenSpec(.consuming):
34543448
self = .consuming
3455-
case TokenSpec(.sending) where experimentalFeatures.contains(.sendingArgsAndResults):
3449+
case TokenSpec(.sending):
34563450
self = .sending
34573451
default:
34583452
return nil

Sources/SwiftSyntax/generated/Keyword.swift

-3
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,6 @@ public enum Keyword: UInt8, Hashable, Sendable {
203203
#endif
204204
case scoped
205205
case `self`
206-
#if compiler(>=5.8)
207-
@_spi(ExperimentalLanguageFeatures)
208-
#endif
209206
case sending
210207
case `Self`
211208
case Sendable

Tests/SwiftParserTest/DeclarationTests.swift

+3-12
Original file line numberDiff line numberDiff line change
@@ -3281,18 +3281,9 @@ final class DeclarationTests: ParserTestCase {
32813281
}
32823282

32833283
func testSendingTypeSpecifier() {
3284-
assertParse(
3285-
"func testVarDeclTupleElt() -> (sending String, String) {}",
3286-
experimentalFeatures: .sendingArgsAndResults
3287-
)
3288-
assertParse(
3289-
"func testVarDeclTuple2(_ x: (sending String)) {}",
3290-
experimentalFeatures: .sendingArgsAndResults
3291-
)
3292-
assertParse(
3293-
"func testVarDeclTuple2(_ x: (sending String, String)) {}",
3294-
experimentalFeatures: .sendingArgsAndResults
3295-
)
3284+
assertParse("func testVarDeclTupleElt() -> (sending String, String) {}")
3285+
assertParse("func testVarDeclTuple2(_ x: (sending String)) {}")
3286+
assertParse("func testVarDeclTuple2(_ x: (sending String, String)) {}")
32963287
}
32973288

32983289
func testMisplacedAttributeInVarDeclWithMultipleBindings() {

Tests/SwiftParserTest/SendingTest.swift

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ final class SendingTests: ParserTestCase {
1919
"""
2020
class Klass {}
2121
func transferMain(_ x: sending Klass) -> ()
22-
""",
23-
experimentalFeatures: .sendingArgsAndResults
22+
"""
2423
)
2524
}
2625

@@ -29,8 +28,7 @@ final class SendingTests: ParserTestCase {
2928
"""
3029
class Klass {}
3130
func transferMain(_ y: Klass, _ x: sending Klass, _ z: Klass) -> ()
32-
""",
33-
experimentalFeatures: .sendingArgsAndResults
31+
"""
3432
)
3533
}
3634
}

0 commit comments

Comments
 (0)