Skip to content

Commit 6459333

Browse files
committed
Add regression test for https://bugs.swift.org/browse/SR-5056
This looks like a subtle issue. It was broken in 4.1 and got fixed in 4.2, perhaps by the decl checker cleanups or some other change. I don't see many occurrences of 'required convenience' in the non-executable tests, period, so it's good to have a bit more coverage for this corner of the language.
1 parent ba3fa2f commit 6459333

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/decl/inherit/initializer.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,22 @@ func testClassInGenericFunc<T>(t: T) {
110110
_ = B(t: t)
111111
}
112112

113+
114+
// <https://bugs.swift.org/browse/SR-5056> Required convenience init inhibits inheritance
115+
116+
class SR5056A {
117+
required init(a: Int) {}
118+
}
119+
120+
class SR5056B : SR5056A {
121+
required convenience init(b: Int) {
122+
self.init(a: b)
123+
}
124+
}
125+
126+
class SR5056C : SR5056B {}
127+
128+
func useSR5056C() {
129+
_ = SR5056C(a: 0)
130+
_ = SR5056C(b: 0)
131+
}

0 commit comments

Comments
 (0)