mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Private and fileprivate declarations have a special "private discriminator" to keep them from colliding with declarations with the same signature in another file. The debugger uses this to prefer declarations in the file you're currently stopped in when running the expression parser. Unfortunately, the current logic didn't just prefer declarations in the current file---it /only/ took declarations in the current file, as long as there weren't zero. The fixed version will include any declarations in the current file plus any declarations with 'internal' or broader access. (Really we shouldn't do this at the lookup level at all; it should just be a tie-breaker in solution ranking in the constraint solver. But that would be a more intrusive change.) rdar://problem/27015195
13 lines
423 B
Swift
13 lines
423 B
Swift
private var global: String = "abc"
|
|
|
|
extension MyStruct {
|
|
private static func method() -> String? { return nil }
|
|
}
|
|
|
|
// Note: These are deliberately 'private' here and 'internal' in the other file.
|
|
// They're testing that we don't filter out non-discriminated decls in lookup.
|
|
private func process(_ x: String) -> String { return x }
|
|
extension MyStruct {
|
|
private static func process(_ x: String) -> String { return x }
|
|
}
|