-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.concurrencyFeature: umbrella label for concurrency language featuresFeature: umbrella label for concurrency language features
Description
Description
It used to be possible to override a class like UIView
/NSView
to provide a new designated initializer that delegated to the parent's designated initializer. It no longer is with swiftlang-6.0.0.7.6
.
Reproduction
class A: NSView {
// Call to main actor-isolated initializer 'init(frame:)' in a synchronous nonisolated context
init() {
super.init(frame: .zero)
}
// It's 2024 and I still have to write this lol but anyway that's not what this bug is about
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
Expected behavior
This compiles like it's done for many versions of Swift.
Actual behavior:
Call to main actor-isolated initializer 'init(frame:)' in a synchronous nonisolated context
No other variant works either:
class A: NSView {
// Main actor-isolated initializer 'init()' has different actor isolation from nonisolated overridden declaration
@MainActor
init() {
super.init(frame: .zero)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
This one is particularly puzzling. Why would init()
on a @MainActor
type be nonisolated? This seems like a serious regression too:
@MainActor
class A: NSView {
init() {
// Call to main actor-isolated initializer 'init(frame:)' in a synchronous nonisolated context
super.init(frame: .zero)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
Environment
swift-driver version: 1.113 Apple Swift version 6.0 (swiftlang-6.0.0.7.6 clang-1600.0.24.1)
Target: arm64-apple-macosx14.0
Additional information
It's also completely impossible to figure out what actor isolation the class / constructors have. CMD+Click on Xcode to show the interface does not show any actor isolation information:

alex-vasenin and AlexBlack559
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.concurrencyFeature: umbrella label for concurrency language featuresFeature: umbrella label for concurrency language features