Files
swift-mirror/test/Sema/read_requirements.swift
Daniel Rodríguez Troitiño ba68faaed5 [test] Mark tests that use experimental/upcoming features as such
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.
2024-11-02 11:46:46 -07:00

152 lines
2.0 KiB
Swift

// RUN: %target-typecheck-verify-swift \
// RUN: -verify-additional-prefix enabled- \
// RUN: -enable-experimental-feature CoroutineAccessors \
// RUN: -debug-diagnostic-names
// REQUIRES: swift_feature_CoroutineAccessors
// A read requirement may be satisfied by
// - a stored property
// - a _read accessor
// - a read accessor
// - a get accessor
// - an unsafeAddress accessor
struct U : ~Copyable {}
protocol P : ~Copyable {
@_borrowed
var ubgs: U { get set }
var urs: U { read set }
var ur: U { read }
}
struct ImplStored : ~Copyable & P {
var ubgs: U
var urs: U
var ur: U
}
struct ImplUnderscoredCoroutineAccessors : ~Copyable & P {
typealias Property = U
var _i: U
var ubgs: U {
_read {
yield _i
}
_modify {
yield &_i
}
}
var urs: U {
_read {
yield _i
}
_modify {
yield &_i
}
}
var ur: U {
_read {
yield _i
}
}
}
struct ImplCoroutineAccessors : ~Copyable & P {
var _i: U
var ubgs: U {
read {
yield _i
}
modify {
yield &_i
}
}
var urs: U {
read {
yield _i
}
modify {
yield &_i
}
}
var ur: U {
read {
yield _i
}
}
}
struct ImplGetSet : P {
var _i: U {
get { return U() }
set {}
}
var ubgs: U {
get {
return _i
}
set {
_i = newValue
}
}
var urs: U {
get {
return _i
}
set {
_i = newValue
}
}
var ur: U {
get {
return _i
}
set {
_i = newValue
}
}
}
struct ImplUnsafeAddressors : P {
var iAddr: UnsafePointer<U>
var iMutableAddr: UnsafeMutablePointer<U> {
.init(mutating: iAddr)
}
var ubgs: U {
unsafeAddress {
return iAddr
}
unsafeMutableAddress {
return iMutableAddr
}
}
var urs: U {
unsafeAddress {
return iAddr
}
unsafeMutableAddress {
return iMutableAddr
}
}
var ur: U {
unsafeAddress {
return iAddr
}
unsafeMutableAddress {
return iMutableAddr
}
}
}