mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
While in the constraint system, the delegation is modeled as returning an instance of the derived class, in the AST we type the reference as returning an instance of the base class, and insert a downcast, because in SILGen we're calling the base class initializer which is typed as returning the base class. This bit of fixup logic wasn't happening if the base class was generic, and so we were not inserting the cast, which would crash in SILGen with an assert. Fixes <rdar://problem/31000248>.
17 lines
299 B
Swift
17 lines
299 B
Swift
// RUN: %target-swift-frontend -emit-silgen -primary-file %s -o /dev/null
|
|
|
|
class Base<T> {
|
|
convenience init(count: Int) {
|
|
self.init(count: count, designated: ())
|
|
}
|
|
|
|
init(count: Int, designated: ()) {
|
|
}
|
|
}
|
|
|
|
class Derived<T> : Base<T> {
|
|
convenience init() {
|
|
self.init(count: 0)
|
|
}
|
|
}
|