Files
swift-mirror/test/Sema/immutability_overload_async.swift
Doug Gregor 39f4e38027 Diagnose inout uses of 'lets' in constructors in the type checker.
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.
2024-05-14 15:59:50 -07:00

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()
}
}