Skip to content
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
1 change: 1 addition & 0 deletions include/swift/Basic/Features.def
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ UPCOMING_FEATURE(ForwardTrailingClosures, 286, 6)
UPCOMING_FEATURE(BareSlashRegexLiterals, 354, 6)
UPCOMING_FEATURE(ExistentialAny, 335, 6)
UPCOMING_FEATURE(ImportObjcForwardDeclarations, 384, 6)
UPCOMING_FEATURE(StrictConcurrency, 337, 6)

EXPERIMENTAL_FEATURE(StaticAssert, false)
EXPERIMENTAL_FEATURE(VariadicGenerics, false)
Expand Down
4 changes: 4 additions & 0 deletions lib/AST/ASTPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3173,6 +3173,10 @@ static bool usesFeatureExistentialAny(Decl *decl) {
return false;
}

static bool usesFeatureStrictConcurrency(Decl *decl) {
return false;
}

static bool usesFeatureImportObjcForwardDeclarations(Decl *decl) {
ClangNode clangNode = decl->getClangNode();
if (!clangNode)
Expand Down
2 changes: 2 additions & 0 deletions lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,

} else if (Args.hasArg(OPT_warn_concurrency)) {
Opts.StrictConcurrencyLevel = StrictConcurrency::Complete;
} else if (Opts.hasFeature(Feature::StrictConcurrency)) {
Opts.StrictConcurrencyLevel = StrictConcurrency::Complete;
} else {
// Default to minimal checking in Swift 5.x.
Opts.StrictConcurrencyLevel = StrictConcurrency::Minimal;
Expand Down
21 changes: 21 additions & 0 deletions test/Concurrency/upcoming_feature_strictconcurrency.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// RUN: %target-typecheck-verify-swift -enable-upcoming-feature StrictConcurrency
// REQUIRES: concurrency

class C1 { } // expected-note{{class 'C1' does not conform to the 'Sendable' protocol}}
class C2 { }

@available(*, unavailable)
extension C2: Sendable {} // expected-note{{conformance of 'C2' to 'Sendable' has been explicitly marked unavailable here}}

protocol TestProtocol {
associatedtype Value: Sendable
}

struct Test1: TestProtocol { // expected-warning{{type 'Test1.Value' (aka 'C1') does not conform to the 'Sendable' protocol}}
typealias Value = C1
}

struct Test2: TestProtocol { // expected-warning{{conformance of 'C2' to 'Sendable' is unavailable}}
// expected-note@-1{{in associated type 'Self.Value' (inferred as 'C2')}}
typealias Value = C2
}