This repository has been archived by the owner on Apr 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 197
Allow LLDB repl to properly handle redefinition of expressions. #1340
Open
bgogul
wants to merge
3
commits into
apple:stable
Choose a base branch
from
bgogul:ambiguous
base: stable
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Please use SwiftREPL::GetSourceFileBasename rather than hardcoding "repl.swift". Other than that, this should do the trick.
Jim
… On Mar 1, 2019, at 3:36 PM, Gogul Balakrishnan ***@***.***> wrote:
Currently, lldb's REPL mode does not work well with extensions. Specifically, we cannot redefine an extension. Consider the following LLDB repl session:
Welcome to Swift version 5.0-dev (LLVM dcb9eb74a7, Clang 95cdf7c9af, Swift 56a798a3ea).
Type :help for assistance.
1> struct Foo {}
2> extension Foo { func f() -> Int { return 1 } }
3> Foo().f()
$R0: Int = 1
4> extension Foo { func f() -> Int { return 2 } }
5> Foo().f()
error: repl.swift:5:1: error: ambiguous use of 'f()'
Foo().f()
^
repl.swift:2:22: note: found this candidate
extension Foo { func f() -> Int { return 1 } }
^
repl.swift:4:22: note: found this candidate
extension Foo { func f() -> Int { return 2 } }
^
As you can see redefining a function in an extension causes an ambiguous use diagnostic. This PR uses the additional hooks declared in swiftlang/swift#23031 to deal with redefinition of extensions.
See the discussion on the swift forum for more context.
You can view, comment on, or merge this pull request online at:
#1340
Commit Summary
• Eliminate spurious ambiguous name errors in REPL.
• Made three versions of finishLookup.
File Changes
• M source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp (75)
Patch Links:
• https://github.com/apple/swift-lldb/pull/1340.patch
• https://github.com/apple/swift-lldb/pull/1340.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Thanks for the quick response. Done! |
dcci
suggested changes
Mar 2, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a test.
Also, somebody working on the frontend should sign this off. |
Thanks @dcci. I will certainly add a test. I am waiting for the swiftlang/swift#23031 PR to be merged in. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, lldb's REPL mode does not work well with extensions. Specifically, we cannot redefine an extension. Consider the following LLDB repl session:
As you can see redefining a function in an extension causes an ambiguous use diagnostic. This PR uses the additional hooks declared in swiftlang/swift#23031 to deal with redefinition of extensions.
See the discussion on the swift forum for more context.