Files
swift-mirror/test/NameBinding/Inputs/HasPrivateAccess1.swift
Jordan Rose cd7c802972 Lookup using private discriminators should still find public things. (#4238)
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
2016-08-12 09:38:37 -07:00

13 lines
407 B
Swift

private var global: Int = 1
public struct MyStruct {
private static func method() -> Int? { return nil }
}
// Note: These are deliberately 'internal' here and 'private' in the other file.
// They're testing that we don't filter out non-discriminated decls in lookup.
internal func process(_ x: Int) -> Int { return x }
extension MyStruct {
internal static func process(_ x: Int) -> Int { return x }
}