Skip to content

Commit 89103ca

Browse files
authored
Merge pull request #13327 from slavapestov/test-trailing-closure-with-init
Add test case for trailing closure with self/super.init
2 parents 2514f70 + 3502102 commit 89103ca

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/expr/closure/trailing.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,3 +367,28 @@ func testVariadic() {
367367
let c2 = variadicAndNonOverload {}
368368
_ = c2 as String // expected-error {{cannot convert value of type 'Bool' to type 'String'}}
369369
}
370+
371+
// rdar://18426302
372+
373+
class TrailingBase {
374+
init(fn: () -> ()) {}
375+
init(x: Int, fn: () -> ()) {}
376+
377+
convenience init() {
378+
self.init {}
379+
}
380+
381+
convenience init(x: Int) {
382+
self.init(x: x) {}
383+
}
384+
}
385+
386+
class TrailingDerived : TrailingBase {
387+
init(foo: ()) {
388+
super.init {}
389+
}
390+
391+
init(x: Int, foo: ()) {
392+
super.init(x: x) {}
393+
}
394+
}

0 commit comments

Comments
 (0)