diff --git a/include/swift/Basic/Features.def b/include/swift/Basic/Features.def index c6b3de80207eb..ea48841274269 100644 --- a/include/swift/Basic/Features.def +++ b/include/swift/Basic/Features.def @@ -267,6 +267,7 @@ SUPPRESSIBLE_LANGUAGE_FEATURE(ABIAttributeSE0479, 479, "@abi attribute on functi LANGUAGE_FEATURE(BuiltinSelect, 0, "Builtin.select") LANGUAGE_FEATURE(AlwaysInheritActorContext, 472, "@_inheritActorContext(always)") LANGUAGE_FEATURE(NonescapableAccessorOnTrivial, 0, "Support UnsafeMutablePointer.mutableSpan") +LANGUAGE_FEATURE(InlineArrayTypeSugar, 483, "Type sugar for InlineArray") // Swift 6 UPCOMING_FEATURE(ConciseMagicFile, 274, 6) @@ -508,9 +509,6 @@ EXPERIMENTAL_FEATURE(ExtensibleEnums, true) /// Syntax sugar features for concurrency. EXPERIMENTAL_FEATURE(ConcurrencySyntaxSugar, true) -/// Enable syntax sugar type '[3 of Int]' for Inline Array -EXPERIMENTAL_FEATURE(InlineArrayTypeSugar, false) - /// Allow declaration of compile-time values EXPERIMENTAL_FEATURE(CompileTimeValues, true) diff --git a/lib/ASTGen/Sources/ASTGen/SourceFile.swift b/lib/ASTGen/Sources/ASTGen/SourceFile.swift index 03c13f0193fa6..060e29c452dc7 100644 --- a/lib/ASTGen/Sources/ASTGen/SourceFile.swift +++ b/lib/ASTGen/Sources/ASTGen/SourceFile.swift @@ -77,7 +77,6 @@ extension Parser.ExperimentalFeatures { mapFeature(.CoroutineAccessors, to: .coroutineAccessors) mapFeature(.OldOwnershipOperatorSpellings, to: .oldOwnershipOperatorSpellings) mapFeature(.KeyPathWithMethodMembers, to: .keypathWithMethodMembers) - mapFeature(.InlineArrayTypeSugar, to: .inlineArrayTypeSugar) mapFeature(.DefaultIsolationPerFile, to: .defaultIsolationPerFile) } } diff --git a/lib/Parse/ParseType.cpp b/lib/Parse/ParseType.cpp index 62115e223c4a1..28bf11f65a4dd 100644 --- a/lib/Parse/ParseType.cpp +++ b/lib/Parse/ParseType.cpp @@ -1318,8 +1318,6 @@ ParserResult Parser::parseTypeTupleBody() { } ParserResult Parser::parseTypeInlineArray(SourceLoc lSquare) { - ASSERT(Context.LangOpts.hasFeature(Feature::InlineArrayTypeSugar)); - ParserStatus status; // 'isStartOfInlineArrayTypeBody' means we should at least have a type and @@ -1824,9 +1822,6 @@ bool Parser::canParseType() { } bool Parser::canParseStartOfInlineArrayType() { - if (!Context.LangOpts.hasFeature(Feature::InlineArrayTypeSugar)) - return false; - // We must have at least '[ of', which cannot be any other kind of // expression or type. We specifically look for any type, not just integers // for better recovery in e.g cases where the user writes '[Int of 2]'. We @@ -1844,9 +1839,6 @@ bool Parser::canParseStartOfInlineArrayType() { } bool Parser::isStartOfInlineArrayTypeBody() { - if (!Context.LangOpts.hasFeature(Feature::InlineArrayTypeSugar)) - return false; - BacktrackingScope backtrack(*this); return canParseStartOfInlineArrayType(); } @@ -1856,7 +1848,7 @@ bool Parser::canParseCollectionType() { return false; // Check to see if we have an InlineArray sugar type. - if (Context.LangOpts.hasFeature(Feature::InlineArrayTypeSugar)) { + { CancellableBacktrackingScope backtrack(*this); if (canParseStartOfInlineArrayType()) { backtrack.cancelBacktrack(); diff --git a/test/ASTGen/types.swift b/test/ASTGen/types.swift index 4deed574e649f..3af33a56e512f 100644 --- a/test/ASTGen/types.swift +++ b/test/ASTGen/types.swift @@ -2,22 +2,18 @@ // RUN: %target-swift-frontend-dump-parse -enable-experimental-feature ParserASTGen \ // RUN: -enable-experimental-feature NamedOpaqueTypes \ -// RUN: -enable-experimental-feature InlineArrayTypeSugar \ // RUN: | %sanitize-address > %t/astgen.ast // RUN: %target-swift-frontend-dump-parse \ // RUN: -enable-experimental-feature NamedOpaqueTypes \ -// RUN: -enable-experimental-feature InlineArrayTypeSugar \ // RUN: | %sanitize-address > %t/cpp-parser.ast // RUN: %diff -u %t/astgen.ast %t/cpp-parser.ast // RUN: %target-typecheck-verify-swift -enable-experimental-feature ParserASTGen \ -// RUN: -enable-experimental-feature NamedOpaqueTypes \ -// RUN: -enable-experimental-feature InlineArrayTypeSugar +// RUN: -enable-experimental-feature NamedOpaqueTypes // REQUIRES: swift_feature_ParserASTGen // REQUIRES: swift_feature_NamedOpaqueTypes -// REQUIRES: swift_feature_InlineArrayTypeSugar // rdar://116686158 // UNSUPPORTED: asan diff --git a/test/Availability/inline_array_availability.swift b/test/Availability/inline_array_availability.swift index a15b36cca1b3c..aaf809fb97c6c 100644 --- a/test/Availability/inline_array_availability.swift +++ b/test/Availability/inline_array_availability.swift @@ -1,6 +1,5 @@ -// RUN: %target-typecheck-verify-swift -enable-experimental-feature InlineArrayTypeSugar -target %target-cpu-apple-macosx15.0 +// RUN: %target-typecheck-verify-swift -target %target-cpu-apple-macosx15.0 -// REQUIRES: swift_feature_InlineArrayTypeSugar // REQUIRES: OS=macosx func foo(x: InlineArray<3, Int>) {} diff --git a/test/DebugInfo/sugar_inline_array.swift b/test/DebugInfo/sugar_inline_array.swift index 5e6411122c51c..7e8423f4bf1d2 100644 --- a/test/DebugInfo/sugar_inline_array.swift +++ b/test/DebugInfo/sugar_inline_array.swift @@ -1,6 +1,4 @@ -// RUN: %target-swift-frontend %s -emit-ir -enable-experimental-feature InlineArrayTypeSugar -disable-availability-checking -g -o - | %FileCheck %s - -// REQUIRES: swift_feature_InlineArrayTypeSugar +// RUN: %target-swift-frontend %s -emit-ir -disable-availability-checking -g -o - | %FileCheck %s let a: ([3 of Int], InlineArray<3, Int>) = ([1, 2, 3], [1, 2, 3]) let b: ([3 of [1 of String]], InlineArray<3, InlineArray<1, String>>) = ([[""], [""], [""]], [[""], [""], [""]]) diff --git a/test/IDE/complete_inline_array.swift b/test/IDE/complete_inline_array.swift index 4b0bc8ef6d27e..bf63c73b0c4e6 100644 --- a/test/IDE/complete_inline_array.swift +++ b/test/IDE/complete_inline_array.swift @@ -1,6 +1,4 @@ -// RUN: %batch-code-completion -enable-experimental-feature InlineArrayTypeSugar - -// REQUIRES: swift_feature_InlineArrayTypeSugar +// RUN: %batch-code-completion struct FooBar {} diff --git a/test/Sema/inlinearray.swift b/test/Sema/inlinearray.swift index 065d218344faa..30f1a6853510b 100644 --- a/test/Sema/inlinearray.swift +++ b/test/Sema/inlinearray.swift @@ -1,6 +1,4 @@ -// RUN: %target-typecheck-verify-swift -disable-availability-checking -enable-experimental-feature InlineArrayTypeSugar - -// REQUIRES: swift_feature_InlineArrayTypeSugar +// RUN: %target-typecheck-verify-swift -disable-availability-checking let a: InlineArray = [1, 2, 3] // Ok, InlineArray<3, Int> let b: InlineArray<_, Int> = [1, 2, 3] // Ok, InlineArray<3, Int> diff --git a/test/Serialization/value_generics.swift b/test/Serialization/value_generics.swift index 47913756d0756..72f036e38feb1 100644 --- a/test/Serialization/value_generics.swift +++ b/test/Serialization/value_generics.swift @@ -1,9 +1,8 @@ // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend %s -emit-module -enable-experimental-feature RawLayout -enable-experimental-feature InlineArrayTypeSugar -disable-availability-checking -parse-as-library -o %t +// RUN: %target-swift-frontend %s -emit-module -enable-experimental-feature RawLayout -disable-availability-checking -parse-as-library -o %t // RUN: %target-sil-opt -enable-sil-verify-all %t/value_generics.swiftmodule -o - | %FileCheck %s // REQUIRES: swift_feature_RawLayout -// REQUIRES: swift_feature_InlineArrayTypeSugar // CHECK: @_rawLayout(likeArrayOf: Element, count: Count) struct Vector : ~Copyable where Element : ~Copyable { @_rawLayout(likeArrayOf: Element, count: Count) diff --git a/test/type/inline_array.swift b/test/type/inline_array.swift index 8ec1486df62b3..63b39e156b6f2 100644 --- a/test/type/inline_array.swift +++ b/test/type/inline_array.swift @@ -1,6 +1,4 @@ -// RUN: %target-typecheck-verify-swift -enable-experimental-feature InlineArrayTypeSugar -disable-availability-checking - -// REQUIRES: swift_feature_InlineArrayTypeSugar +// RUN: %target-typecheck-verify-swift -disable-availability-checking let _: [3 of Int] let _ = [3 of Int](repeating: 0) diff --git a/test/type/inline_array_disabled.swift b/test/type/inline_array_disabled.swift deleted file mode 100644 index 74f6a2b850294..0000000000000 --- a/test/type/inline_array_disabled.swift +++ /dev/null @@ -1,19 +0,0 @@ -// RUN: %target-typecheck-verify-swift - -// Make sure InlineArray type sugar is disabled by default. -// FIXME: The recovery here really isn't great. -do { - let _: [3 of Int] // expected-note {{to match this opening '['}} - // expected-error@-1 4{{expected}} - // expected-error@-2 4{{consecutive statements on a line must be separated by ';'}} - // expected-warning@-3 2{{is unused}} - // expected-error@-4 {{cannot find 'of' in scope}} - // expected-note@-5 {{add arguments after the type to construct a value of the type}} - // expected-note@-6 {{use '.self' to reference the type object}} -} -do { - let _ = [3 of Int]() - // expected-error@-1 {{cannot call value of non-function type '[Int]'}} - // expected-error@-2 {{expected ',' separator}} - // expected-error@-3 {{cannot find 'of' in scope}} -}