Files
swift-mirror/test/decl/class/actor/initializers.swift
Allan Shortlidge cb578172ea Tests: Remove -disable-availability-checking in more tests that use concurrency.
Use the `%target-swift-5.1-abi-triple` substitution to compile the tests for
deployment to the minimum OS versions required for use of _Concurrency APIs,
instead of disabling availability checking.
2024-10-19 12:35:20 -07:00

37 lines
616 B
Swift

// RUN: %target-swift-frontend -swift-version 5 -target %target-swift-5.1-abi-triple -emit-sil -verify %s
// check the initializer kinds for protocols and their extensions
protocol GoodActor {
init()
init(with: Int)
}
extension GoodActor {
init() {
self.init(with: 0)
}
init(with: Int) {} // expected-error {{'self.init' isn't called on all paths before returning from initializer}}
}
actor Myself: GoodActor {
var x: Int
init(with val: Int) {
self.x = val
}
}
actor SomebodyElse: GoodActor {
var x: Int
init(with val: Int) {
self.x = val
}
init() {
self.x = 0
}
}