mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +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
44 lines
2.0 KiB
Swift
44 lines
2.0 KiB
Swift
// RUN: rm -rf %t && mkdir -p %t
|
|
|
|
// RUN: %target-swift-frontend -emit-module -o %t -module-name HasPrivateAccess %S/Inputs/HasPrivateAccess1.swift %S/Inputs/HasPrivateAccess2.swift
|
|
// RUN: %target-swift-ide-test -print-ast-typechecked -source-filename %s -I %t -sdk "" -disable-access-control 2>&1 | %FileCheck -check-prefix=CHECK-ERROR %s
|
|
// RUN: %target-swift-ide-test -print-ast-typechecked -source-filename %s -I %t -sdk "" -disable-access-control -explode-pattern-binding-decls -debug-client-discriminator _5AB3F657DD2A7E5E793501C5FA480C3D | %FileCheck -check-prefix=CHECK-INT %s
|
|
// RUN: %target-swift-ide-test -print-ast-typechecked -source-filename %s -I %t -sdk "" -disable-access-control -explode-pattern-binding-decls -debug-client-discriminator _0D6EC78101B0986747C7103C2739A767 | %FileCheck -check-prefix=CHECK-STRING %s
|
|
|
|
import HasPrivateAccess
|
|
|
|
// CHECK-ERROR: ambiguous use of 'global'
|
|
// CHECK-INT: let unqualified: Int
|
|
// CHECK-STRING: let unqualified: String
|
|
let unqualified = global
|
|
|
|
// CHECK-ERROR: ambiguous use of 'global'
|
|
// CHECK-INT: let qualified: Int
|
|
// CHECK-STRING: let qualified: String
|
|
let qualified = HasPrivateAccess.global
|
|
|
|
// CHECK-ERROR: ambiguous use of 'method()'
|
|
// CHECK-INT: let result: Int?
|
|
// CHECK-STRING: let result: String?
|
|
let result = HasPrivateAccess.MyStruct.method()
|
|
|
|
// CHECK-ERROR: let processedInt: Int
|
|
// CHECK-INT: let processedInt: Int
|
|
// CHECK-STRING: let processedInt: Int
|
|
let processedInt = process(1)
|
|
|
|
// CHECK-ERROR: let processedIntQualified: Int
|
|
// CHECK-INT: let processedIntQualified: Int
|
|
// CHECK-STRING: let processedIntQualified: Int
|
|
let processedIntQualified = MyStruct.process(1)
|
|
|
|
// CHECK-ERROR: let processedString: String
|
|
// CHECK-INT: let processedString: String
|
|
// CHECK-STRING: let processedString: String
|
|
let processedString = process("abc")
|
|
|
|
// CHECK-ERROR: let processedStringQualified: String
|
|
// CHECK-INT: let processedStringQualified: String
|
|
// CHECK-STRING: let processedStringQualified: String
|
|
let processedStringQualified = MyStruct.process("abc")
|