Skip to content

Commit 255b2cf

Browse files
committed
[NFC] Improve Nested Types Table Test
To guard against the kind of complex failures seen in rdar://58690068, improve this regression test with a copy of a shrunken version of CocoaError.Code. In that radar, CocoaError.Code was defined in one overlay and extended in another translation unit. When deserialization encountered this, it failed to search the overlay's nested type tables and fell through to re-enter lookupDirect.
1 parent 423bcdf commit 255b2cf

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

test/Serialization/Inputs/nested-type-with-overlay/overlay.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,13 @@ extension Base {
88
}
99

1010
public var shadowedFromSwift = Base.NestedAndShadowed(dummy: ())
11+
12+
public struct CustomError {
13+
public struct Code : RawRepresentable {
14+
public let rawValue: Int
15+
16+
public init(rawValue: Int) {
17+
self.rawValue = rawValue
18+
}
19+
}
20+
}

test/Serialization/nested-type-with-overlay.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
// REQUIRES: asserts
1010

11-
// CHECK: 3 Serialization - # of nested types resolved without full lookup
12-
// Unfortunately this isn't 4 because of the shadowed nested type from Clang.
11+
// CHECK: 4 Serialization - # of nested types resolved without full lookup
12+
// Unfortunately this isn't 5 because of the shadowed nested type from Clang.
1313

1414
import HasOverlay
1515

@@ -20,3 +20,9 @@ public func resolveNestedTypes(
2020

2121
public var shadowedFromClang = getShadowedFromClang()
2222
public var shadowedFromSwift = HasOverlay.shadowedFromSwift
23+
24+
extension CustomError.Code {
25+
public static var failedSuccessfully: CustomError.Code {
26+
return CustomError.Code(rawValue: -9999)
27+
}
28+
}

0 commit comments

Comments
 (0)