mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[AST/Sema] Hide using declaration behind DefaultIsolationPerFile experimental feature
(cherry picked from commit c246a7a372)
This commit is contained in:
@@ -2186,6 +2186,8 @@ ERROR(nonisolated_nonsending_repeated,none,
|
||||
ERROR(using_decl_invalid_specifier,PointsToFirstBadToken,
|
||||
"'using' declaration does not support %0 %select{modifier|attribute}1",
|
||||
(Identifier, bool))
|
||||
ERROR(experimental_using_decl_disabled,PointsToFirstBadToken,
|
||||
"'using' is an experimental feature that is currently disabled", ())
|
||||
|
||||
#define UNDEFINE_DIAGNOSTIC_MACROS
|
||||
#include "DefineDiagnosticMacros.h"
|
||||
|
||||
@@ -522,6 +522,10 @@ EXPERIMENTAL_FEATURE(AllowRuntimeSymbolDeclarations, true)
|
||||
/// Optimize copies of ObjectiveC blocks.
|
||||
EXPERIMENTAL_FEATURE(CopyBlockOptimization, true)
|
||||
|
||||
/// Allow use of `using` declaration that control default isolation
|
||||
/// in a file scope.
|
||||
EXPERIMENTAL_FEATURE(DefaultIsolationPerFile, false)
|
||||
|
||||
#undef EXPERIMENTAL_FEATURE_EXCLUDED_FROM_MODULE_INTERFACE
|
||||
#undef EXPERIMENTAL_FEATURE
|
||||
#undef UPCOMING_FEATURE
|
||||
|
||||
@@ -632,6 +632,10 @@ static bool usesFeatureAlwaysInheritActorContext(Decl *decl) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool usesFeatureDefaultIsolationPerFile(Decl *D) {
|
||||
return isa<UsingDecl>(D);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MARK: - FeatureSet
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -78,6 +78,7 @@ extension Parser.ExperimentalFeatures {
|
||||
mapFeature(.OldOwnershipOperatorSpellings, to: .oldOwnershipOperatorSpellings)
|
||||
mapFeature(.KeyPathWithMethodMembers, to: .keypathWithMethodMembers)
|
||||
mapFeature(.InlineArrayTypeSugar, to: .inlineArrayTypeSugar)
|
||||
mapFeature(.DefaultIsolationPerFile, to: .defaultIsolationPerFile)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6647,6 +6647,10 @@ ParserResult<UsingDecl> Parser::parseDeclUsing(ParseDeclOptions Flags,
|
||||
assert(Tok.isContextualKeyword("using"));
|
||||
DebuggerContextChange DCC(*this);
|
||||
|
||||
if (!Context.LangOpts.hasFeature(Feature::DefaultIsolationPerFile)) {
|
||||
diagnose(Tok, diag::experimental_using_decl_disabled);
|
||||
}
|
||||
|
||||
SourceLoc UsingLoc = consumeToken();
|
||||
|
||||
if (Tok.is(tok::code_complete)) {
|
||||
|
||||
@@ -2,19 +2,22 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-swift-frontend-dump-parse -disable-availability-checking -enable-experimental-move-only -enable-experimental-concurrency -enable-experimental-feature ParserASTGen \
|
||||
// RUN: -enable-experimental-feature CoroutineAccessors \
|
||||
// RUN: -enable-experimental-feature DefaultIsolationPerFile \
|
||||
// RUN: | %sanitize-address > %t/astgen.ast
|
||||
// RUN: %target-swift-frontend-dump-parse -disable-availability-checking -enable-experimental-move-only -enable-experimental-concurrency \
|
||||
// RUN: -enable-experimental-feature CoroutineAccessors \
|
||||
// RUN: -enable-experimental-feature DefaultIsolationPerFile \
|
||||
// RUN: | %sanitize-address > %t/cpp-parser.ast
|
||||
|
||||
// RUN: %diff -u %t/astgen.ast %t/cpp-parser.ast
|
||||
|
||||
// RUN: %target-run-simple-swift(-Xfrontend -disable-availability-checking -Xfrontend -enable-experimental-concurrency -enable-experimental-feature CoroutineAccessors -enable-experimental-feature ParserASTGen)
|
||||
// RUN: %target-run-simple-swift(-Xfrontend -disable-availability-checking -Xfrontend -enable-experimental-concurrency -enable-experimental-feature CoroutineAccessors -enable-experimental-feature DefaultIsolationPerFile -enable-experimental-feature ParserASTGen)
|
||||
|
||||
// REQUIRES: executable_test
|
||||
// REQUIRES: swift_swift_parser
|
||||
// REQUIRES: swift_feature_ParserASTGen
|
||||
// REQUIRES: swift_feature_CoroutineAccessors
|
||||
// REQUIRES: swift_feature_DefaultIsolationPerFile
|
||||
|
||||
// rdar://116686158
|
||||
// UNSUPPORTED: asan
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
|
||||
// RUN: %target-typecheck-verify-swift -disable-availability-checking -enable-bare-slash-regex -enable-experimental-feature ParserASTGen
|
||||
// RUN: %target-typecheck-verify-swift -disable-availability-checking \
|
||||
// RUN: -enable-bare-slash-regex \
|
||||
// RUN: -enable-experimental-feature ParserASTGen \
|
||||
// RUN: -enable-experimental-feature DefaultIsolationPerFile
|
||||
|
||||
// REQUIRES: swift_swift_parser
|
||||
// REQUIRES: swift_feature_ParserASTGen
|
||||
// REQUIRES: swift_feature_DefaultIsolationPerFile
|
||||
|
||||
// rdar://116686158
|
||||
// UNSUPPORTED: asan
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
// RUN: %target-swift-emit-module-interface(%t.swiftinterface) %s
|
||||
// RUN: %target-swift-emit-module-interface(%t.swiftinterface) %s -enable-experimental-feature DefaultIsolationPerFile
|
||||
|
||||
// RUN: %target-swift-typecheck-module-from-interface(%t.swiftinterface)
|
||||
|
||||
// RUN: %FileCheck %s --input-file %t.swiftinterface
|
||||
|
||||
// REQUIRES: swift_feature_DefaultIsolationPerFile
|
||||
|
||||
using @MainActor
|
||||
|
||||
// CHECK-NOT: using @MainActor
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// RUN: %target-typecheck-verify-swift
|
||||
// RUN: %target-typecheck-verify-swift -enable-experimental-feature DefaultIsolationPerFile
|
||||
|
||||
// REQUIRES: swift_feature_DefaultIsolationPerFile
|
||||
|
||||
// REQUIRES: concurrency
|
||||
|
||||
|
||||
Reference in New Issue
Block a user