Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0085-rdar31000248.swift
Slava Pestov 19b12aa3b1 Sema: Fix convenience init delegation to a convenience init in a generic base class
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>.
2017-03-26 00:00:53 -07:00

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