Skip to content

Commit 21b3b45

Browse files
authored
Merge pull request #3126 from hamishknight/enable-inlinearray-sugar-6.2
[6.2] Enable InlineArray type sugar
2 parents a0db756 + 6d10686 commit 21b3b45

File tree

15 files changed

+9
-39
lines changed

15 files changed

+9
-39
lines changed

CodeGeneration/Sources/SyntaxSupport/ExperimentalFeatures.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public enum ExperimentalFeature: String, CaseIterable {
2121
case coroutineAccessors
2222
case keypathWithMethodMembers
2323
case oldOwnershipOperatorSpellings
24-
case inlineArrayTypeSugar
2524
case defaultIsolationPerFile
2625

2726
/// The name of the feature as it is written in the compiler's `Features.def` file.
@@ -43,8 +42,6 @@ public enum ExperimentalFeature: String, CaseIterable {
4342
return "KeypathWithMethodMembers"
4443
case .oldOwnershipOperatorSpellings:
4544
return "OldOwnershipOperatorSpellings"
46-
case .inlineArrayTypeSugar:
47-
return "InlineArrayTypeSugar"
4845
case .defaultIsolationPerFile:
4946
return "DefaultIsolationPerFile"
5047
}
@@ -69,8 +66,6 @@ public enum ExperimentalFeature: String, CaseIterable {
6966
return "keypaths with method members"
7067
case .oldOwnershipOperatorSpellings:
7168
return "`_move` and `_borrow` as ownership operators"
72-
case .inlineArrayTypeSugar:
73-
return "sugar type for InlineArray"
7469
case .defaultIsolationPerFile:
7570
return "set default actor isolation for a file"
7671
}

CodeGeneration/Sources/SyntaxSupport/TypeNodes.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ public let TYPE_NODES: [Node] = [
302302
Node(
303303
kind: .inlineArrayType,
304304
base: .type,
305-
experimentalFeature: .inlineArrayTypeSugar,
306305
nameForDiagnostics: "inline array type",
307306
documentation: "An inline array type `[3 of Int]`, sugar for `InlineArray<3, Int>`.",
308307
children: [

Sources/SwiftParser/Types.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,6 @@ extension Parser {
646646
unexpectedBeforeLSquare: RawUnexpectedNodesSyntax?,
647647
leftSquare: RawTokenSyntax
648648
) -> RawTypeSyntax {
649-
precondition(self.experimentalFeatures.contains(.inlineArrayTypeSugar))
650-
651649
// We allow both values and types here and for the element type for
652650
// better recovery in cases where the user writes e.g '[Int of 3]'.
653651
let count = self.parseGenericArgumentType()
@@ -875,10 +873,6 @@ extension Parser.Lookahead {
875873
/// Checks whether we can parse the start of an InlineArray type. This does
876874
/// not include the element type.
877875
mutating func canParseStartOfInlineArrayTypeBody() -> Bool {
878-
guard self.experimentalFeatures.contains(.inlineArrayTypeSugar) else {
879-
return false
880-
}
881-
882876
// We must have at least '[<type-or-integer> of', which cannot be any other
883877
// kind of expression or type. We specifically look for both types and
884878
// integers for better recovery in e.g cases where the user writes e.g
@@ -907,7 +901,7 @@ extension Parser.Lookahead {
907901

908902
mutating func canParseCollectionTypeBody() -> Bool {
909903
// Check to see if we have an InlineArray sugar type.
910-
if self.experimentalFeatures.contains(.inlineArrayTypeSugar) {
904+
do {
911905
var lookahead = self.lookahead()
912906
if lookahead.canParseInlineArrayTypeBody() {
913907
self = lookahead

Sources/SwiftParser/generated/ExperimentalFeatures.swift

Lines changed: 1 addition & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwiftSyntax/Documentation.docc/generated/SwiftSyntax.md

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwiftSyntax/generated/SyntaxAnyVisitor.swift

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwiftSyntax/generated/SyntaxEnum.swift

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwiftSyntax/generated/SyntaxKind.swift

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwiftSyntax/generated/SyntaxRewriter.swift

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)