mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Stored `let` properties of a struct, class, or actor permit 'inout' modification within the constructor body after they have been initialized. Tentatively remove this rule, only allowing such `let` properties to be initialized (assigned to) and not treated as `inout`. Fixes rdar://127258363.
32 lines
932 B
Swift
32 lines
932 B
Swift
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify
|
|
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted
|
|
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete
|
|
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -enable-upcoming-feature RegionBasedIsolation
|
|
|
|
// REQUIRES: concurrency
|
|
// REQUIRES: asserts
|
|
|
|
protocol Iterator {
|
|
associatedtype Failure: Error
|
|
mutating func next() async throws -> Int?
|
|
}
|
|
|
|
extension Iterator {
|
|
mutating func next() async throws(Failure) -> Int? {
|
|
nil
|
|
}
|
|
}
|
|
|
|
actor C: Iterator {
|
|
typealias Failure = any Error
|
|
func next() throws -> Int? { nil }
|
|
}
|
|
|
|
actor A {
|
|
let c = C()
|
|
|
|
init() async {
|
|
_ = try! await self.c.next()
|
|
}
|
|
}
|