Skip to content

[Parser] Remove abiAttribute experimental feature #3025

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

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public enum ExperimentalFeature: String, CaseIterable {
case trailingComma
case coroutineAccessors
case valueGenerics
case abiAttribute
case keypathWithMethodMembers
case oldOwnershipOperatorSpellings

Expand All @@ -41,8 +40,6 @@ public enum ExperimentalFeature: String, CaseIterable {
return "CoroutineAccessors"
case .valueGenerics:
return "ValueGenerics"
case .abiAttribute:
return "ABIAttribute"
case .keypathWithMethodMembers:
return "KeypathWithMethodMembers"
case .oldOwnershipOperatorSpellings:
Expand All @@ -67,8 +64,6 @@ public enum ExperimentalFeature: String, CaseIterable {
return "coroutine accessors"
case .valueGenerics:
return "value generics"
case .abiAttribute:
return "@abi attribute"
case .keypathWithMethodMembers:
return "keypaths with method members"
case .oldOwnershipOperatorSpellings:
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftParser/Attributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ extension Parser {
case TokenSpec(._typeEraser): self = ._typeEraser
case TokenSpec(._unavailableFromAsync): self = ._unavailableFromAsync
case TokenSpec(.`rethrows`): self = .rethrows
case TokenSpec(.abi) where experimentalFeatures.contains(.abiAttribute): self = .abi
case TokenSpec(.abi): self = .abi
case TokenSpec(.attached): self = .attached
case TokenSpec(.available): self = .available
case TokenSpec(.backDeployed): self = .backDeployed
Expand Down
9 changes: 2 additions & 7 deletions Sources/SwiftParser/generated/ExperimentalFeatures.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 27 additions & 53 deletions Tests/SwiftParserTest/AttributeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1008,73 +1008,64 @@ final class AttributeTests: ParserTestCase {
returnClause: ReturnClauseSyntax(type: TypeSyntax("Int"))
)
) {},
experimentalFeatures: [.abiAttribute]
experimentalFeatures: []
)

assertParse(
"""
@abi(associatedtype AssocTy)
associatedtype AssocTy
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
@abi(deinit)
deinit {}
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
enum EnumCaseDeclNotParsedAtTopLevel {
@abi(case someCase)
case someCase
}
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
@abi(func fn())
func fn()
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
@abi(init())
init() {}
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
@abi(subscript(i: Int) -> Element)
subscript(i: Int) -> Element {}
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
@abi(typealias Typealias = @escaping () -> Void)
typealias Typealias = () -> Void
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
@abi(let c1, c2)
let c1, c2
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
@abi(var v1, v2)
var v1, v2
""",
experimentalFeatures: [.abiAttribute]
"""
)

assertParse(
Expand All @@ -1089,8 +1080,7 @@ final class AttributeTests: ParserTestCase {
),
diagnostics: [
DiagnosticSpec(locationMarker: "1️⃣", message: "editor placeholder in source file")
],
experimentalFeatures: [.abiAttribute]
]
)

assertParse(
Expand All @@ -1114,8 +1104,7 @@ final class AttributeTests: ParserTestCase {
),
diagnostics: [
DiagnosticSpec(locationMarker: "1️⃣", message: "import is not permitted as ABI-providing declaration")
],
experimentalFeatures: [.abiAttribute]
]
)

//
Expand All @@ -1126,66 +1115,57 @@ final class AttributeTests: ParserTestCase {
"""
@abi(associatedtype AssocTy = T)
associatedtype AssocTy
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
@abi(deinit {})
deinit {}
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
enum EnumCaseDeclNotParsedAtTopLevel {
@abi(case someCase = 42)
case someCase
}
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
@abi(func fn() {})
func fn()
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
@abi(init() {})
init() {}
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
@abi(subscript(i: Int) -> Element { get {} set {} })
subscript(i: Int) -> Element {}
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
@abi(let c1 = 1, c2 = 2)
let c1, c2
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
@abi(var v1 = 1, v2 = 2)
var v1, v2
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
@abi(var v3 { get {} set {} })
var v3
""",
experimentalFeatures: [.abiAttribute]
"""
)

//
Expand All @@ -1207,8 +1187,7 @@ final class AttributeTests: ParserTestCase {
fixedSource: """
@abi(var <#pattern#>)
var v1
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
Expand All @@ -1231,8 +1210,7 @@ final class AttributeTests: ParserTestCase {
fixedSource: """
@abi(var v2)
var v2
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
Expand All @@ -1250,8 +1228,7 @@ final class AttributeTests: ParserTestCase {
fixedSource: """
@abi(<#declaration#>)
func fn2() {}
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
Expand All @@ -1268,8 +1245,7 @@ final class AttributeTests: ParserTestCase {
fixedSource: """
@abi(<#declaration#>)
func fn3() {}
""",
experimentalFeatures: [.abiAttribute]
"""
)
assertParse(
"""
Expand All @@ -1291,8 +1267,7 @@ final class AttributeTests: ParserTestCase {
fixedSource: """
@abi(<#declaration#>) func fn4_abi())
func fn4() {}
""",
experimentalFeatures: [.abiAttribute]
"""
)

// `#if` is banned inside an `@abi` attribute.
Expand Down Expand Up @@ -1325,8 +1300,7 @@ final class AttributeTests: ParserTestCase {
func _fn<E: Error>() throws(E)
)
func fn<E: Error>() throws(E) {}
""",
experimentalFeatures: [.abiAttribute]
"""
)
}

Expand Down
Loading