Files
swift-mirror/test/ClangImporter/objc_init_override_kind.swift
Slava Pestov 7ba2b35e6a ClangImporter: Fix init kind computation with overridden constructors
We used to compute the init kind from the overridden declaration;
this was switched to use the base declaration in 42f72cb0d.

Refactor the init kind computation a little to get the old behavior
back. Otherwise, if a class defines an initializer named -init, we
always import it as designated by virtue of overridding NSObject's
-init.

Fixes <rdar://problem/56674158>.
2019-11-01 18:54:10 -04:00

16 lines
389 B
Swift

// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -import-objc-header %S/Inputs/objc_init_override_kind.h %s
// REQUIRES: objc_interop
import Foundation
// rdar://problem/56674158
class Derived : Base {
// This is not flagged as an error, because Base.init() is a
// convenience init.
init() { super.init(foo: 123) }
required init?(coder: NSCoder) {}
}