Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Medium
-
Resolution: Done
-
Component/s: LLDB for Swift
-
Labels:None
-
Radar URL:
Description
This test case:
import Foundation final class Foo { func bar() { DispatchQueue.main.async { [weak self] in if let `self` = self { print(self) } } } } let foo = Foo() foo.bar() dispatchMain()
Causes this error when attempting to `po self` inside of the dispatch closure:
error: 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 ~~~~^~~~~~~~~~~~~~~~~~~~ _ error: <EXPR>:18:5: error: value of type 'Foo' has no member '$__lldb_wrapped_expr_0' $__lldb_injected_self.$__lldb_wrapped_expr_0( ^~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
To reproduce this you can compile and debug it with this:
$ swiftc -g foo.swift $ lldb ./foo (lldb) target create "./foo" Current executable set to './foo' (x86_64). (lldb) br set -f foo.swift -l 7 Breakpoint 1: where = foo`closure #1 () -> () in foo.Foo.bar() -> () + 118 at foo.swift:7, address = 0x0000000100001ec6 (lldb) r ... Target 0: (foo) stopped. (lldb) po self error: 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 ~~~~^~~~~~~~~~~~~~~~~~~~ _ error: <EXPR>:18:5: error: value of type 'Foo' has no member '$__lldb_wrapped_expr_0' $__lldb_injected_self.$__lldb_wrapped_expr_0( ^~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
This is probably the same core issue as https://bugs.swift.org/browse/SR-3886 but I wanted to file it separately since it has a different test case.