Skip to content

Commit a2e0e27

Browse files
committed
[test] Add some more tests for 73d4526.
There's still nothing really complicated going on here, such as an override that previously satisfied a protocol conformance.
1 parent 7e8d642 commit a2e0e27

File tree

3 files changed

+67
-9
lines changed

3 files changed

+67
-9
lines changed

test/Serialization/Recovery/Inputs/custom-modules/Overrides.h

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,33 @@
33
@end
44

55
@interface Base : Object
6-
#ifndef BAD
7-
- (void)method;
6+
#if !BAD
7+
- (void)disappearingMethod;
8+
- (nullable id)nullabilityChangeMethod;
9+
- (nonnull id)typeChangeMethod;
10+
#else
11+
//- (void)disappearingMethod;
12+
- (nonnull id)nullabilityChangeMethod;
13+
- (nonnull Base *)typeChangeMethod;
14+
#endif
15+
@end
16+
17+
@interface Base (ExtraMethodsToTriggerCircularReferences)
18+
#if !BAD
19+
- (void)disappearingMethodWithOverload;
20+
#else
21+
//- (void)disappearingMethodWithOverload;
22+
#endif
23+
@end
24+
25+
@interface GenericBase<Element>: Object
26+
#if !BAD
27+
- (void)disappearingMethod;
28+
- (nullable Element)nullabilityChangeMethod;
29+
- (nonnull id)typeChangeMethod;
30+
#else
31+
//- (void)disappearingMethod;
32+
- (nonnull Element)nullabilityChangeMethod;
33+
- (nonnull Element)typeChangeMethod;
834
#endif
935
@end

test/Serialization/Recovery/crash-recovery.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
import Overrides
1010

1111
public class Sub: Base {
12-
public override func method() {}
12+
public override func disappearingMethod() {}
1313
}
1414

1515
// CHECK-CRASH: error: fatal error encountered while reading from module 'Lib'; please file a bug report with your project and the crash log
1616
// CHECK-CRASH-3-NOT: note
1717
// CHECK-CRASH-4: note: compiling as Swift 4.0, with 'Lib' built as Swift 3.1
1818
// CHECK-CRASH-LABEL: *** DESERIALIZATION FAILURE (please include this section in any bug report) ***
19-
// CHECK-CRASH: could not find 'method()' in parent class
19+
// CHECK-CRASH: could not find 'disappearingMethod()' in parent class
2020
// CHECK-CRASH: While loading members for 'Sub' in module 'Lib'

test/Serialization/Recovery/overrides.swift

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,47 @@
99

1010
import Overrides
1111

12-
public class Sub: Base {
13-
public override func method() {}
12+
// Please use prefixes to keep the printed parts of this file in alphabetical
13+
// order.
14+
15+
public class SwiftOnlyClass {}
16+
17+
public class A_Sub: Base {
18+
public override func disappearingMethod() {}
19+
public override func nullabilityChangeMethod() -> Any? { return nil }
20+
public override func typeChangeMethod() -> Any { return self }
21+
public override func disappearingMethodWithOverload() {}
22+
}
23+
24+
// CHECK-LABEL: class A_Sub : Base {
25+
// CHECK-NEXT: func disappearingMethod()
26+
// CHECK-NEXT: func nullabilityChangeMethod() -> Any?
27+
// CHECK-NEXT: func typeChangeMethod() -> Any
28+
// CHECK-NEXT: func disappearingMethodWithOverload()
29+
// CHECK-NEXT: init()
30+
// CHECK-NEXT: {{^}$}}
31+
32+
// CHECK-RECOVERY-LABEL: class A_Sub : Base {
33+
// CHECK-RECOVERY-NEXT: init()
34+
// CHECK-RECOVERY-NEXT: {{^}$}}
35+
36+
extension Base {
37+
@nonobjc func disappearingMethodWithOverload() -> SwiftOnlyClass? { return nil }
38+
}
39+
40+
public class B_GenericSub : GenericBase<Base> {
41+
public override func disappearingMethod() {}
42+
public override func nullabilityChangeMethod() -> Base? { return nil }
43+
public override func typeChangeMethod() -> Any { return self }
1444
}
1545

16-
// CHECK-LABEL: class Sub : Base {
17-
// CHECK-NEXT: func method()
46+
// CHECK-LABEL: class B_GenericSub : GenericBase<Base> {
47+
// CHECK-NEXT: func disappearingMethod()
48+
// CHECK-NEXT: func nullabilityChangeMethod() -> Base?
49+
// CHECK-NEXT: func typeChangeMethod() -> Any
1850
// CHECK-NEXT: init()
1951
// CHECK-NEXT: {{^}$}}
2052

21-
// CHECK-RECOVERY-LABEL: class Sub : Base {
53+
// CHECK-RECOVERY-LABEL: class B_GenericSub : GenericBase<Base> {
2254
// CHECK-RECOVERY-NEXT: init()
2355
// CHECK-RECOVERY-NEXT: {{^}$}}

0 commit comments

Comments
 (0)