mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
When forming the Swift name lookup tables, import-as-member'd declarations can precede the declaration of the context into which they'll be imported as a member. In such cases, we already had logic to delay the resolution until the end of the model (when the context must be complete). However, we would only delay when there is a swift_name attribute on the declaration, which is... conceptually correct. If the swift_name exists but is versioned (e.g., it is present only for Swift 4+), and we're building before the swift_name took effect (e.g., in Swift 3 mode), the swift_name is buried under a "versioned" attribute in the Clang AST. Therefore, we would end up dropping the declaration from the name lookup table, which almost doesn't matter, except... Serialization records the newest names for such declarations (e.g., Swift 4+ name in this case), so deserialization would fail to find the declaration that had been dropped, causing a crash. Eliminate the "optimization" that looks for the swift_name attribute before delaying the resolution of such a declaration, so we'll visit these later. Fixes rdar://problem/39115605.
7 lines
151 B
Swift
7 lines
151 B
Swift
import Foundation
|
|
import ImportAsMember.Class
|
|
|
|
@inline(__always) public func call_foo() -> Any {
|
|
return foo("hello" as IncompleteImportTargetName)
|
|
}
|