File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,11 @@ class AbstractFunction {
155
155
}
156
156
}
157
157
158
+ // Constructor delegation.
159
+ if (auto otherCtorDeclRef = dyn_cast<OtherConstructorDeclRefExpr>(fn)) {
160
+ return AbstractFunction (otherCtorDeclRef->getDecl ());
161
+ }
162
+
158
163
// Normal function references.
159
164
if (auto declRef = dyn_cast<DeclRefExpr>(fn)) {
160
165
ValueDecl *decl = declRef->getDecl ();
Original file line number Diff line number Diff line change @@ -584,3 +584,22 @@ func suchThat<A>(_ x: Box<A>) -> (@escaping (A) -> A) -> Box<A> {
584
584
}
585
585
586
586
Box ( unbox: 1 ) |> suchThat <| { $0 + 1 } // expected-warning {{result of operator '<|' is unused}}
587
+
588
+ // Constructor delegation -vs- rethrows
589
+ class RethrowingConstructor {
590
+ init ( _ block: ( ) throws -> ( ) ) rethrows {
591
+ try block ( )
592
+ }
593
+
594
+ convenience init ( bar: Int ) {
595
+ self . init {
596
+ print ( " Foo! " )
597
+ }
598
+ }
599
+
600
+ convenience init ( baz: Int ) throws {
601
+ try self . init {
602
+ try throwingFunc ( )
603
+ }
604
+ }
605
+ }
You can’t perform that action at this time.
0 commit comments