mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This responds to some feedback on the forums. Most importantly this allows for us to use variadic generics in the the type system to document whether we allow for "appending" behavior or not. Previously, for some options we would take the last behavior (and theoretically) for others would have silently had appending behavior. This just makes the behavior simple and more explicit.
21 lines
1.0 KiB
Swift
21 lines
1.0 KiB
Swift
// RUN: %target-swift-frontend -enable-experimental-feature SwiftSettings -enable-experimental-feature Macros -c -swift-version 6 -disable-availability-checking -verify -Xllvm -swift-settings-allow-duplicates %s
|
|
|
|
// REQUIRES: asserts
|
|
// REQUIRES: concurrency
|
|
// REQUIRES: swift_feature_Macros
|
|
// REQUIRES: swift_feature_SwiftSettings
|
|
|
|
actor MyActor {}
|
|
|
|
#SwiftSettings(.defaultIsolation(MainActor.self))
|
|
#SwiftSettings(.defaultIsolation(nil))
|
|
#SwiftSettings(.defaultIsolation(MyActor.self)) // expected-error {{Unrecognized setting passed to #SwiftSettings}}
|
|
#SwiftSettings(.defaultIsolation(1)) // expected-error {{Unrecognized setting passed to #SwiftSettings}}
|
|
// expected-error @-1 {{cannot convert value of type 'Int' to expected argument type 'any Actor.Type'}}
|
|
#SwiftSettings(2) // expected-error {{Unrecognized setting passed to #SwiftSettings}}
|
|
// expected-error @-1 {{cannot convert value of type 'Int' to expected argument type 'SwiftSetting'}}
|
|
|
|
#SwiftSettings(.defaultIsolation(MainActor.self),
|
|
.defaultIsolation(nil))
|
|
|