Skip to content

Conversation

@jrose-apple
Copy link
Contributor

  • Explanation: 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. This resulting in things like == not being found if someone had declared a private == for their private type. The fixed version will include any declarations in the current file plus any declarations with internal or broader access.
  • Scope: Only the debugger's expression parser is using this code path, but it does use it for every expression.
  • Issue: rdar://problem/27015195
  • Reviewed by: @scallanan, @jimingham
  • Risk: Low.
  • Testing: Added a compiler regression test. LLDB also has additional tests we could cherry-pick (https://github.com/apple/swift-lldb/commits/master/packages/Python/lldbsuite/test/lang/swift/expression/equality_operators).

…wiftlang#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
(cherry picked from commit cd7c802)
@jrose-apple jrose-apple modified the milestone: Swift 3.0 Aug 30, 2016
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple jrose-apple merged commit 6eca2bf into swiftlang:swift-3.0-branch Aug 30, 2016
@jrose-apple jrose-apple deleted the swift-3-private-discriminators-should-not-be-exclusive branch August 30, 2016 20:56
kateinoigakukun added a commit that referenced this pull request Aug 31, 2022
[pull] swiftwasm from main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant