Skip to content

Commit 0f7aabb

Browse files
Remove two upcoming feature field properties
- Remove parsing and coding for: - available property - enabledInLanguageVersion property - Update tests for new expected results - See issue #31 for rationale - Resolves #31
1 parent dd8d717 commit 0f7aabb

File tree

3 files changed

+2
-32
lines changed

3 files changed

+2
-32
lines changed

Sources/EvolutionMetadataExtraction/Extractors/FieldExtractors/UpcomingFeatureFlagExtractor.swift

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ struct UpcomingFeatureFlagExtractor: MarkupWalker, ValueExtractor {
1616
private var errors: [Proposal.Issue] = []
1717

1818
private var flag: String?
19-
private var available: String?
20-
private var enabled: String?
2119

2220
private var uff: Proposal.UpcomingFeatureFlag? {
2321
if let flag {
24-
return Proposal.UpcomingFeatureFlag(flag: flag, available: available, enabledInLanguageMode: enabled)
22+
return Proposal.UpcomingFeatureFlag(flag: flag)
2523
} else {
2624
return nil
2725
}
@@ -50,14 +48,4 @@ struct UpcomingFeatureFlagExtractor: MarkupWalker, ValueExtractor {
5048
mutating func visitInlineCode(_ inlineCode: InlineCode) -> () {
5149
flag = inlineCode.code
5250
}
53-
54-
mutating func visitText(_ text: Text) -> () {
55-
if let match = text.string.firstMatch(of: /\([Ii]mplemented in Swift (\d(\.\d)*)\)/) {
56-
available = String(match.1)
57-
}
58-
59-
if let match = text.string.firstMatch(of: /\(Enabled in Swift (\d(\.\d)*) language mode\)/) {
60-
enabled = String(match.1)
61-
}
62-
}
6351
}

Sources/EvolutionMetadataModel/Proposal+UpcomingFeatureFlag.swift

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,8 @@ extension Proposal {
1515
/// The upcoming feature flag
1616
public let flag: String
1717

18-
/// The Swift version when this flag became available.
19-
///
20-
/// Only present if the Swift version is different than the implemenation version of the proposal.
21-
public let available: String?
22-
23-
/// Swift language version (language mode) where the flag is always enabled and therefore no longer necessary.
24-
///
25-
/// Only present for publicly announced language versions.
26-
public let enabledInLanguageMode: String?
27-
28-
public init(flag: String, available: String?, enabledInLanguageMode: String?) {
18+
public init(flag: String) {
2919
self.flag = flag
30-
self.available = available
31-
self.enabledInLanguageMode = enabledInLanguageMode
3220
}
3321
}
3422
}

Tests/ExtractionTests/Resources/AllProposals.evosnapshot/expected-results.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12565,7 +12565,6 @@
1256512565
"summary" : "[SE-0279 \"Multiple Trailing Closures\"](https:\/\/github.com\/swiftlang\/swift-evolution\/blob\/master\/proposals\/0279-multiple-trailing-closures.md) threaded the needle between getting the syntax we wanted for multiple trailing closures without breaking source compatibility. One aspect of that compromise was to extend (rather than replace) the existing rule for matching a trailing closure to a parameter by scanning *backward* from the end of the parameter list.",
1256612566
"title" : "Forward-scan matching for trailing closures",
1256712567
"upcomingFeatureFlag" : {
12568-
"available" : "5.8",
1256912568
"flag" : "ForwardTrailingClosures"
1257012569
}
1257112570
},
@@ -14867,7 +14866,6 @@
1486714866
"summary" : "Existential types in Swift have an extremely lightweight spelling: a plain protocol name in type context means an existential type. Over the years, this has risen to the level of **active harm** by causing confusion, leading programmers down the wrong path that often requires them to re-write code once they hit a fundamental [limitation of value-level abstraction](https:\/\/forums.swift.org\/t\/improving-the-ui-of-generics\/22814#heading--limits-of-existentials). This proposal makes the impact of existential types explicit in the language by annotating such types with `any`.",
1486814867
"title" : "Introduce existential `any`",
1486914868
"upcomingFeatureFlag" : {
14870-
"available" : "5.8",
1487114869
"flag" : "ExistentialAny"
1487214870
}
1487314871
},
@@ -15617,8 +15615,6 @@
1561715615
"summary" : "Existential types in Swift allow one to store a value whose specific type is unknown and may change at runtime. The dynamic type of that stored value, which we refer to as the existential's *underlying type*, is known only by the set of protocols it conforms to and, potentially, its superclass. While existential types are useful for expressing values of dynamic type, they are necessarily restricted because of their dynamic nature. Recent proposals have made [existential types more explicit](https:\/\/github.com\/swiftlang\/swift-evolution\/blob\/main\/proposals\/0335-existential-any.md) to help developers understand this dynamic nature, as well as [making existential types more expressive](https:\/\/github.com\/swiftlang\/swift-evolution\/blob\/main\/proposals\/0309-unlock-existential-types-for-all-protocols.md) by removing a number of limitations. However, a fundamental issue with existential types remains, that once you have a value of existential type it is *very* hard to use generics with it. Developers usually encounter this via the error message \"protocol 'P' as a type cannot conform to itself\":",
1561815616
"title" : "Implicitly Opened Existentials",
1561915617
"upcomingFeatureFlag" : {
15620-
"available" : "6.0",
15621-
"enabledInLanguageMode" : "6",
1562215618
"flag" : "ImplicitOpenExistentials"
1562315619
}
1562415620
},
@@ -15730,7 +15726,6 @@
1573015726
"summary" : "We propose the introduction of regex literals to Swift source code, providing compile-time checks and typed-capture inference. Regex literals help complete the story told in *[Regex Type and Overview](https:\/\/github.com\/swiftlang\/swift-evolution\/blob\/main\/proposals\/0350-regex-type-overview.md)*.",
1573115727
"title" : "Regex Literals",
1573215728
"upcomingFeatureFlag" : {
15733-
"available" : "5.8",
1573415729
"flag" : "BareSlashRegexLiterals"
1573515730
}
1573615731
},
@@ -18932,7 +18927,6 @@
1893218927
"summary" : "This proposal defines options for the usage of global variables free of data races. Within this proposal, global variables encompass any storage of static duration: `let`s and stored `var`s that are either declared at global scope or as static member variables.",
1893318928
"title" : "Strict concurrency for global variables",
1893418929
"upcomingFeatureFlag" : {
18935-
"enabledInLanguageMode" : "6",
1893618930
"flag" : "GlobalConcurrency"
1893718931
}
1893818932
},

0 commit comments

Comments
 (0)