mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Anonymous contexts (e.g. types nested inside functons) require special handling when we are constructing a fully-qualified name. We construct the name by walking from a type's descriptor to its parent contexts. Previously, we would give up upon encountering an anonymous contexts. This change refactors fully-qualified name construction to happen in two phases: 1. Collect a full context ancestor chain 2. Walk the chain backwards to reconstruct the fully-qualified name As opposed to the previous approach which always constructed the name while recursively walking to the parent context. This is required because types nested inside anonymous contexts are represented in the fully-qualified type name as `(type_name in $XXXXXXXX)` where XXXXXXXX is the address of the context descriptor of the parent anonymous context. Resolves rdar://91073103
43 lines
1.2 KiB
Swift
43 lines
1.2 KiB
Swift
public protocol MyProto {}
|
|
struct StructA : MyProto, Hashable {
|
|
var x: Int
|
|
}
|
|
|
|
struct SomeStruct {
|
|
public func someFunc() -> Int {
|
|
struct SomeNestedStruct : MyProto {}
|
|
return 42
|
|
}
|
|
}
|
|
|
|
struct foo {
|
|
struct bar {
|
|
struct baz {
|
|
struct qux {
|
|
struct quux {
|
|
struct corge {
|
|
struct grault {
|
|
struct garply {
|
|
struct waldo {
|
|
struct fred {
|
|
struct plugh {
|
|
struct xyzzy {
|
|
struct thud {
|
|
struct SomeConformingType : MyProto {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
extension foo : MyProto {}
|