Skip to content

Commit b92a4eb

Browse files
authored
Merge pull request #27131 from jckarter/regression-test-8789
Add regression test for SR-8789.
2 parents 2163698 + 0caf21c commit b92a4eb

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#import <Foundation/Foundation.h>
2+
3+
4+
// NB: No NS_ASSUME_NONNULL
5+
6+
@protocol FooProtocol <NSObject>
7+
8+
@property (nonatomic,readonly) NSString *name;
9+
10+
@end
11+
12+
13+
@interface ParentClass : NSObject
14+
15+
- (instancetype)initWithFoo:(id<FooProtocol>)foo;
16+
17+
@end
18+
19+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// SR-8789
2+
3+
// RUN: %target-swift-emit-silgen -verify -import-objc-header %S/Inputs/objc_init_iuo_override.h %s
4+
// REQUIRES: objc_interop
5+
6+
class ChildClass: ParentClass {}
7+
8+
class GrandchildClass: ChildClass {
9+
// The original init is defined in objc as:
10+
// - (instancetype)initWithFoo:(id<FooProtocol>)foo;
11+
// without nullability audits, meaning the signature in Swift is:
12+
// init!(foo: FooProtocol)
13+
// and
14+
override init(foo: FooProtocol) {
15+
super.init(foo: foo)
16+
}
17+
}
18+

0 commit comments

Comments
 (0)