mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Find all the usages of `--enable-experimental-feature` or `--enable-upcoming-feature` in the tests and replace some of the `REQUIRES: asserts` to use `REQUIRES: swift-feature-Foo` instead, which should correctly apply to depending on the asserts/noasserts mode of the toolchain for each feature. Remove some comments that talked about enabling asserts since they don't apply anymore (but I might had miss some). All this was done with an automated script, so some formatting weirdness might happen, but I hope I fixed most of those. There might be some tests that were `REQUIRES: asserts` that might run in `noasserts` toolchains now. This will normally be because their feature went from experimental to upcoming/base and the tests were not updated.
43 lines
977 B
Swift
43 lines
977 B
Swift
// REQUIRES: swift_swift_parser, executable_test
|
|
|
|
// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -enable-experimental-feature Macros -Xfrontend -plugin-path -Xfrontend %swift-plugin-dir) | %FileCheck %s
|
|
|
|
// REQUIRES: observation
|
|
// REQUIRES: concurrency
|
|
// REQUIRES: objc_interop
|
|
// REQUIRES: swift_feature_Macros
|
|
// UNSUPPORTED: use_os_stdlib
|
|
// UNSUPPORTED: back_deployment_runtime
|
|
|
|
import Observation
|
|
|
|
@Observable
|
|
public class Model {
|
|
public enum State {
|
|
case initializing
|
|
case running
|
|
case complete
|
|
}
|
|
|
|
public var state: State = .initializing {
|
|
willSet {
|
|
print("new state=\(String(describing: newValue))")
|
|
}
|
|
|
|
didSet {
|
|
guard oldValue != state else { return }
|
|
print("old state=\(String(describing: oldValue))")
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
let m = Model()
|
|
|
|
// CHECK: new state=running
|
|
// CHECK: old state=initializing
|
|
m.state = .running
|
|
// CHECK: new state=complete
|
|
// CHECK: old state=running
|
|
m.state = .complete
|