Skip to content

Commit 6f334d0

Browse files
committed
Delete dependsOn syntax
1 parent b21d8a4 commit 6f334d0

File tree

6 files changed

+1
-148
lines changed

6 files changed

+1
-148
lines changed

CodeGeneration/Sources/SyntaxSupport/SyntaxNodeKind.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,6 @@ public enum SyntaxNodeKind: String, CaseIterable, IdentifierConvertible, TypeCon
182182
case labeledSpecializeArgument
183183
case labeledStmt
184184
case layoutRequirement
185-
case lifetimeSpecifierArgument
186-
case lifetimeSpecifierArgumentList
187-
case lifetimeTypeSpecifier
188185
case macroDecl
189186
case macroExpansionDecl
190187
case macroExpansionExpr
@@ -290,7 +287,6 @@ public enum SyntaxNodeKind: String, CaseIterable, IdentifierConvertible, TypeCon
290287
case typeExpr
291288
case typeInitializerClause
292289
case typeSpecifier
293-
case lifetimeSpecifierArguments
294290
case typeSpecifierList
295291
case unavailableFromAsyncAttributeArguments
296292
case underscorePrivateAttributeArguments

CodeGeneration/Sources/SyntaxSupport/TypeNodes.swift

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -500,81 +500,6 @@ public let TYPE_NODES: [Node] = [
500500
]
501501
),
502502

503-
Node(
504-
kind: .lifetimeSpecifierArgument,
505-
base: .syntax,
506-
experimentalFeature: .nonescapableTypes,
507-
nameForDiagnostics: nil,
508-
documentation: """
509-
A single argument that can be added to a lifetime specifier like `borrow`, `mutate`, `consume` or `copy`.
510-
511-
### Example
512-
`data` in `func foo(data: Array<Item>) -> borrow(data) ComplexReferenceType`
513-
""",
514-
traits: [
515-
"WithTrailingComma"
516-
],
517-
children: [
518-
Child(
519-
name: "parameter",
520-
kind: .token(choices: [.token(.identifier), .keyword(.self), .token(.integerLiteral)]),
521-
nameForDiagnostics: "parameter reference",
522-
documentation: """
523-
The parameter on which the lifetime of this type depends.
524-
525-
This can be an identifier referring to an external parameter name, an integer literal to refer to an unnamed
526-
parameter or `self` if the type's lifetime depends on the object the method is called on.
527-
"""
528-
),
529-
Child(
530-
name: "trailingComma",
531-
kind: .token(choices: [.token(.comma)]),
532-
isOptional: true
533-
),
534-
]
535-
),
536-
537-
Node(
538-
kind: .lifetimeSpecifierArgumentList,
539-
base: .syntaxCollection,
540-
experimentalFeature: .nonescapableTypes,
541-
nameForDiagnostics: nil,
542-
elementChoices: [.lifetimeSpecifierArgument]
543-
),
544-
545-
Node(
546-
kind: .lifetimeTypeSpecifier,
547-
base: .syntax,
548-
experimentalFeature: .nonescapableTypes,
549-
nameForDiagnostics: "lifetime specifier",
550-
documentation: "A specifier that specifies function parameter on whose lifetime a type depends",
551-
children: [
552-
Child(
553-
name: "dependsOnKeyword",
554-
kind: .token(choices: [.keyword(.dependsOn)]),
555-
documentation: "lifetime dependence specifier on the return type"
556-
),
557-
Child(
558-
name: "leftParen",
559-
kind: .token(choices: [.token(.leftParen)])
560-
),
561-
Child(
562-
name: "scopedKeyword",
563-
kind: .token(choices: [.keyword(.scoped)]),
564-
documentation: "lifetime of return value is scoped to the lifetime of the original value",
565-
isOptional: true
566-
),
567-
Child(
568-
name: "arguments",
569-
kind: .collection(kind: .lifetimeSpecifierArgumentList, collectionElementName: "Arguments")
570-
),
571-
Child(
572-
name: "rightParen",
573-
kind: .token(choices: [.token(.rightParen)])
574-
),
575-
]
576-
),
577-
578503
Node(
579504
kind: .simpleTypeSpecifier,
580505
base: .syntax,
@@ -602,6 +527,6 @@ public let TYPE_NODES: [Node] = [
602527
kind: .typeSpecifierList,
603528
base: .syntaxCollection,
604529
nameForDiagnostics: nil,
605-
elementChoices: [.simpleTypeSpecifier, .lifetimeTypeSpecifier]
530+
elementChoices: [.simpleTypeSpecifier]
606531
),
607532
]

CodeGeneration/Tests/ValidateSyntaxNodes/ValidateSyntaxNodes.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,6 @@ class ValidateSyntaxNodes: XCTestCase {
550550
node: .yieldedExpressionsClause,
551551
message: "could conform to trait 'Parenthesized' but does not"
552552
),
553-
ValidationFailure(node: .lifetimeTypeSpecifier, message: "could conform to trait 'Parenthesized' but does not"),
554553
]
555554
)
556555
}

Sources/SwiftParser/Types.swift

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -874,64 +874,6 @@ extension Parser.Lookahead {
874874
}
875875

876876
extension Parser {
877-
private mutating func parseLifetimeTypeSpecifier() -> RawTypeSpecifierListSyntax.Element {
878-
let (unexpectedBeforeDependsOnKeyword, dependsOnKeyword) = self.expect(.keyword(.dependsOn))
879-
880-
guard let leftParen = self.consume(if: .leftParen) else {
881-
// If there is no left paren, add an entirely missing detail. Otherwise, we start to consume the following type
882-
// name as a token inside the detail, which leads to confusing recovery results.
883-
let lifetimeSpecifierArgumentList = RawLifetimeSpecifierArgumentListSyntax(
884-
elements: [
885-
RawLifetimeSpecifierArgumentSyntax(parameter: missingToken(.identifier), trailingComma: nil, arena: arena)
886-
],
887-
arena: self.arena
888-
)
889-
let lifetimeSpecifier = RawLifetimeTypeSpecifierSyntax(
890-
unexpectedBeforeDependsOnKeyword,
891-
dependsOnKeyword: dependsOnKeyword,
892-
leftParen: missingToken(.leftParen),
893-
scopedKeyword: nil,
894-
arguments: lifetimeSpecifierArgumentList,
895-
rightParen: missingToken(.rightParen),
896-
arena: self.arena
897-
)
898-
return .lifetimeTypeSpecifier(lifetimeSpecifier)
899-
}
900-
901-
let scoped = self.consume(if: .keyword(.scoped))
902-
var keepGoing: RawTokenSyntax?
903-
var arguments: [RawLifetimeSpecifierArgumentSyntax] = []
904-
var loopProgress = LoopProgressCondition()
905-
repeat {
906-
let (unexpectedBeforeParameter, parameter) = self.expect(
907-
anyIn: LifetimeSpecifierArgumentSyntax.ParameterOptions.self,
908-
default: .identifier
909-
)
910-
keepGoing = self.consume(if: .comma)
911-
arguments.append(
912-
RawLifetimeSpecifierArgumentSyntax(
913-
unexpectedBeforeParameter,
914-
parameter: parameter,
915-
trailingComma: keepGoing,
916-
arena: arena
917-
)
918-
)
919-
} while keepGoing != nil && self.hasProgressed(&loopProgress)
920-
let lifetimeSpecifierArgumentList = RawLifetimeSpecifierArgumentListSyntax(elements: arguments, arena: self.arena)
921-
let (unexpectedBeforeRightParen, rightParen) = self.expect(.rightParen)
922-
let lifetimeSpecifier = RawLifetimeTypeSpecifierSyntax(
923-
unexpectedBeforeDependsOnKeyword,
924-
dependsOnKeyword: dependsOnKeyword,
925-
leftParen: leftParen,
926-
scopedKeyword: scoped,
927-
arguments: lifetimeSpecifierArgumentList,
928-
unexpectedBeforeRightParen,
929-
rightParen: rightParen,
930-
arena: self.arena
931-
)
932-
return .lifetimeTypeSpecifier(lifetimeSpecifier)
933-
}
934-
935877
private mutating func parseSimpleTypeSpecifier(
936878
specifierHandle: TokenConsumptionHandle
937879
) -> RawTypeSpecifierListSyntax.Element {
@@ -949,12 +891,6 @@ extension Parser {
949891
SPECIFIER_PARSING: while canHaveParameterSpecifier {
950892
if let (_, specifierHandle) = self.at(anyIn: SimpleTypeSpecifierSyntax.SpecifierOptions.self) {
951893
specifiers.append(parseSimpleTypeSpecifier(specifierHandle: specifierHandle))
952-
} else if self.at(.keyword(.dependsOn)) {
953-
if self.experimentalFeatures.contains(.nonescapableTypes) {
954-
specifiers.append(parseLifetimeTypeSpecifier())
955-
} else {
956-
break SPECIFIER_PARSING
957-
}
958894
} else {
959895
break SPECIFIER_PARSING
960896
}

Sources/SwiftParserDiagnostics/SyntaxExtensions.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ extension TypeSpecifierListSyntax {
211211
return self.compactMap { specifier in
212212
switch specifier {
213213
case .simpleTypeSpecifier(let specifier): return specifier.specifier
214-
case .lifetimeTypeSpecifier: return nil
215214
#if RESILIENT_LIBRARIES
216215
@unknown default:
217216
fatalError()

Sources/SwiftParserDiagnostics/generated/SyntaxKindNameForDiagnostics.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,6 @@ extension SyntaxKind {
251251
return "labeled statement"
252252
case .layoutRequirement:
253253
return "layout requirement"
254-
case .lifetimeTypeSpecifier:
255-
return "lifetime specifier"
256254
case .macroDecl:
257255
return "macro"
258256
case .macroExpansionDecl:

0 commit comments

Comments
 (0)