New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-3886] error: use of undeclared type '$__lldb_context' in NSAttributedString extension #4395
Comments
cc jingham@apple.com (JIRA User), nicely-reduced test case here. |
I just tested this in Xcode 9 beta 2, and the bug is still there, but there is slightly different output now. It mentions that (lldb) po self
error: <EXPR>:3:3: error: 'mutating' isn't valid on methods in classes or class-bound protocols
mutating func $__lldb_wrapped_expr_2(_ $__lldb_arg : UnsafeMutablePointer<Any>) {
^~~~~~~~~
warning: <EXPR>:12:9: warning: initialization of variable '$__lldb_error_result' was never used; consider replacing with assignment to '_' or removing it
var $__lldb_error_result = __lldb_tmp_error
~~~~^~~~~~~~~~~~~~~~~~~~
_ |
I came here to file this with the exact same test case. I assume this wouldn't be a beginner bug, but if there's a place I could start looking at this I'd be up for it! |
Filed a super similar bug here: https://bugs.swift.org/browse/SR-6156 |
@swift-ci create |
I dug into this a bit, so unlike SR-6156, this specific error seems to only affect when the protocol extension is conformed to by an Objective-C class. In this case the `self_type` here is `Self`, so after that I think everything is pretty much borked. Similar to SR-6156, you can see this same problem show up when just running `fr v`
I'm not exactly sure where to solve this part, if anyone else has any guidance that would be greatly appreciated! |
Same thing happening for me, also with the latest beta 10b3. Anything we could do? It's bit of a pain when debugging project with both Obj-c and Swift. Maybe there is a way to force the type of `self` of lldb? |
Looking at this. So, the first bug here is that lldb doesn't resolve the dynamic type correctly in the second case. I have a local patch were I taught swift-lldb about it, but now we fail in the compiler trying to create the ObjC type for the class (in ClangImporter). I need to look at that, but it might take some time. |
This was fixed at some point. I added a test case - apple/swift-lldb#1346 |
Additional Detail from JIRA
md5: a81c62211da4f94aa7a4e278d511c5af
Issue Description:
Given the following Swift code, saved in bug.swift, and using Xcode 8.2.1 or Xcode 8.3 beta 2:
Run the following commands:
LLDB launches. Now, run these commands, and observe the output. Where I pass
9
, pass the line in yourbug.swift
that containsreturn "\(self)"
:The first time we hit the breakpoint, we're in
String
's conformance toMyProtocol
, and we can successfullypo self
.However, the second time we hit the breakpoint, we're in
NSAttributedString
's conformance toMyProtocol
, and LLDB prints gibberish instead of the expected output frompo self
.This is a contrived example, but I run into this all the time in my day-to-day use of Swift and LLDB.
The text was updated successfully, but these errors were encountered: