Uploaded image for project: 'Swift'
  1. Swift
  2. SR-6156

LLDB: warning: initialization of variable '$__lldb_error_result'

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: LLDB for Swift
    • Labels:
      None

      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.

        Attachments

          Activity

            People

            • Assignee:
              aprantl Adrian Prantl
              Reporter:
              keith Keith Smiley
            • Votes:
              4 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

              • Created:
                Updated: