Skip to content

Commit e17e09c

Browse files
committed
Enable effectful properties (SE-310) by default.
1. Removes gating on -enable-experimental-concurrency. 2. Updates eff. prop tests to remove experimental flag, and also adjusts some tests slightly to avoid things that are still behind that flag.
1 parent 21c161d commit e17e09c

17 files changed

+21
-46
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
LANGUAGE_FEATURE(StaticAssert, 0, "#assert", langOpts.EnableExperimentalStaticAssert)
3838
LANGUAGE_FEATURE(AsyncAwait, 296, "async/await", true)
39-
LANGUAGE_FEATURE(EffectfulProp, 310, "Effectful properties", langOpts.EnableExperimentalConcurrency)
39+
LANGUAGE_FEATURE(EffectfulProp, 310, "Effectful properties", true)
4040
LANGUAGE_FEATURE(MarkerProtocol, 0, "@_marker protocol", true)
4141
LANGUAGE_FEATURE(Actors, 0, "actors", true)
4242
LANGUAGE_FEATURE(ConcurrentFunctions, 0, "@concurrent functions", true)

lib/ClangImporter/ImportName.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,8 +1620,7 @@ ImportedName NameImporter::importNameImpl(const clang::NamedDecl *D,
16201620
result.info.accessorKind = ImportedAccessorKind::PropertySetter;
16211621

16221622
// only allow effectful property imports if through `swift_async_name`
1623-
const bool effectfulProperty = parsedName.IsGetter && nameAttr->isAsync
1624-
&& swiftCtx.LangOpts.EnableExperimentalConcurrency;
1623+
const bool effectfulProperty = parsedName.IsGetter && nameAttr->isAsync;
16251624

16261625
// Consider throws and async imports.
16271626
if (method && (parsedName.IsFunctionName || effectfulProperty)) {

lib/Parse/ParseDecl.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6067,9 +6067,6 @@ ParserStatus Parser::parseGetEffectSpecifier(ParsedAccessors &accessors,
60676067
SourceLoc const& currentLoc) {
60686068
ParserStatus Status;
60696069

6070-
if (!shouldParseExperimentalConcurrency())
6071-
return Status;
6072-
60736070
if (isEffectsSpecifier(Tok)) {
60746071
if (currentKind == AccessorKind::Get) {
60756072
Status |=

test/Concurrency/Runtime/effectful_properties.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-run-simple-swift(-parse-as-library -Xfrontend -enable-experimental-concurrency %import-libdispatch) | %FileCheck %s
1+
// RUN: %target-run-simple-swift(-parse-as-library %import-libdispatch) | %FileCheck %s
22

33
// REQUIRES: executable_test
44
// REQUIRES: concurrency

test/IDE/print_clang_objc_effectful_properties.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// RUN: %empty-directory(%t)
22

3-
// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-module -print-implicit-attrs -source-filename %s -module-to-print=EffectfulProperties -function-definitions=false -enable-experimental-concurrency > %t/EffectfulProperties.printed.txt
3+
// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -print-module -print-implicit-attrs -source-filename %s -module-to-print=EffectfulProperties -function-definitions=false > %t/EffectfulProperties.printed.txt
44
// RUN: %FileCheck -input-file %t/EffectfulProperties.printed.txt %s
55

66
// REQUIRES: objc_interop
7-
// REQUIRES: concurrency
87

98
// CHECK-LABEL: class EffProps : NSObject {
109
// CHECK: func getDogWithCompletion(_ completionHandler: @escaping (NSObject) -> Void)
@@ -26,11 +25,11 @@
2625
// CHECK: func nullableHandler(_ completion: ((String) -> Void)? = nil)
2726
// CHECK-NEXT: var fromNullableHandler: String { get async }
2827

29-
// CHECK: func getMainDog(_ completion: @escaping @MainActor (String) -> Void)
28+
// CHECK: func getMainDog(_ completion: @escaping (String) -> Void)
3029
// CHECK-NEXT: var mainDogProp: String { get async }
3130

3231
// CHECK: @completionHandlerAsync("regularMainDog()", completionHandlerIndex: 0)
33-
// CHECK-NEXT: func regularMainDog(_ completion: @escaping @MainActor (String) -> Void)
32+
// CHECK-NEXT: func regularMainDog(_ completion: @escaping (String) -> Void)
3433
// CHECK-NEXT: @discardableResult
3534
// CHECK-NEXT: func regularMainDog() async -> String
3635
// CHECK: }

test/Misc/effectful_properties_keypath.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
// RUN: %target-typecheck-verify-swift -enable-experimental-concurrency
1+
// RUN: %target-typecheck-verify-swift
22

3-
// REQUIRES: concurrency
43
// REQUIRES: objc_interop
54

65
enum E : Error {

test/ModuleInterface/effectful_properties.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -enable-experimental-concurrency -typecheck -swift-version 5 -enable-library-evolution -emit-module-interface-path %t.swiftinterface %s -module-name EffProps
1+
// RUN: %target-swift-frontend -typecheck -swift-version 5 -enable-library-evolution -emit-module-interface-path %t.swiftinterface %s -module-name EffProps
22
// RUN: %FileCheck %s < %t.swiftinterface
33

44
public struct MyStruct {}

test/Parse/effectful_properties.swift

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// RUN: %target-typecheck-verify-swift -enable-experimental-concurrency
2-
// REQUIRES: concurrency
1+
// RUN: %target-typecheck-verify-swift
32

43
struct MyProps {
54
var prop1 : Int {
@@ -112,10 +111,9 @@ var bad1 : Int {
112111
}
113112

114113
var bad2 : Int {
115-
get reasync { 0 } // expected-error{{only function declarations may be marked 'reasync'; did you mean 'async'?}}
114+
get reasync { 0 } // expected-error{{expected '{' to start getter definition}}
116115

117-
// expected-error@+1 {{'set' accessor is not allowed on property with 'get' accessor that is 'async' or 'throws'}}
118-
set reasync { } // expected-error{{'set' accessor cannot have specifier 'reasync'}}
116+
set reasync { }
119117
}
120118

121119
var bad3 : Int {
@@ -158,18 +156,12 @@ var bad8 : Double {
158156
}
159157

160158
protocol BadP {
161-
// expected-error@+3 {{'set' accessor is not allowed on property with 'get' accessor that is 'async' or 'throws'}}
162-
// expected-error@+2 {{only function declarations may be marked 'rethrows'; did you mean 'throws'?}}
163-
// expected-error@+1 {{only function declarations may be marked 'reasync'; did you mean 'async'?}}
164-
var prop1 : Int { get reasync rethrows set }
165-
166159
var prop2 : Int { get bogus rethrows set } // expected-error{{expected get or set in a protocol property}}
167160

168161
// expected-error@+2 {{only function declarations may be marked 'rethrows'; did you mean 'throws'?}}
169162
// expected-error@+1 {{expected get or set in a protocol property}}
170163
var prop3 : Int { get rethrows bogus set }
171164

172-
// expected-error@+2 {{only function declarations may be marked 'reasync'; did you mean 'async'?}}
173165
// expected-error@+1 {{expected get or set in a protocol property}}
174166
var prop4 : Int { get reasync bogus set }
175167

test/SILGen/effectful_properties.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// RUN: %target-swift-frontend -emit-silgen %s -module-name accessors -swift-version 5 -enable-experimental-concurrency | %FileCheck --enable-var-scope %s
2-
// REQUIRES: concurrency
1+
// RUN: %target-swift-frontend -emit-silgen %s -module-name accessors -swift-version 5 | %FileCheck --enable-var-scope %s
32

43
class C {
54
// CHECK-DAG: sil hidden [ossa] @$s9accessors1CC16prop_asyncThrowsSivg : $@convention(method) @async (@guaranteed C) -> (Int, @error Error) {

test/SILGen/objc_effectful_properties.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-silgen -I %S/Inputs/custom-modules -enable-experimental-concurrency %s -verify | %FileCheck --enable-var-scope --check-prefix=CHECK --check-prefix=CHECK-%target-cpu %s
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-silgen -I %S/Inputs/custom-modules %s -verify | %FileCheck --enable-var-scope --check-prefix=CHECK --check-prefix=CHECK-%target-cpu %s
22
// REQUIRES: concurrency
33
// REQUIRES: objc_interop
44

0 commit comments

Comments
 (0)