You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue was originally observed in codebase with async sequence, but I strongly suspect this was the underlying issue.
LLDB seems to be unable to bind generic variables, when suspended in weakly captured context. See example code below.
LLDB version
This example was tested using Xcode toolchain in both Xcode and VSCode:
(lldb) version
lldb-1500.0.404.7
Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Behavior
For context, where self was captured either strongly or as unowned, following expression will be evaluated successfully, referencing example 3, 4 and 5:
(lldb) e -- T.self
(Int.Type) $R0 = Int
However, example 1 results in following output:
(lldb) e -- T.self
error: <EXPR>:2:43: error: cannot find type '$__lldb_context' in scope
extension Swift.Optional where Wrapped == $__lldb_context {
^~~~~~~~~~~~~~~
error: <EXPR>:19:27: error: instance method '$__lldb_user_expr_0' requires the types 'Bridge<Int>' and '<<error type>>' be equivalent
$__lldb_injected_self.$__lldb_user_expr_0(
^
<EXPR>:4:17: note: where 'Wrapped' = 'Bridge<Int>'
mutating func $__lldb_user_expr_0(_ $__lldb_arg : UnsafeMutablePointer<Any>) {
^
Meanwhile, example 2 produces slightly different output:
(lldb) e -- T.self
error: Expression evaluation failed. Retrying without binding generic parameters
error: Could not evaluate the expression without binding generic types.
Notice, that for examples 1 and 2 any expression calls (even interpretable expressions like e -- 1 + 1) end in errors described above.
Example code
import Dispatch
finalclassBridge<T>{varcurrent:Tinit(c:T){ current = c }func foo(){// does not workDispatchQueue.global(qos:.userInitiated).async{[weak self]inprint(self?.current)// example 1}Task{[weak self]inprint(self?.current)// example 2}// worksDispatchQueue.global(qos:.userInitiated).async{print(self.current)// example 3}Task{print(self.current)// example 4}// also worksTask{[unowned self]inprint(self.current)// example 5}}}leta=Bridge(c:1)
a.foo()readLine()
The text was updated successfully, but these errors were encountered:
This issue was originally observed in codebase with async sequence, but I strongly suspect this was the underlying issue.
LLDB seems to be unable to bind generic variables, when suspended in weakly captured context. See example code below.
LLDB version
This example was tested using Xcode toolchain in both Xcode and VSCode:
Behavior
For context, where
self
was captured either strongly or as unowned, following expression will be evaluated successfully, referencing example 3, 4 and 5:However, example 1 results in following output:
Meanwhile, example 2 produces slightly different output:
Notice, that for examples 1 and 2 any expression calls (even interpretable expressions like
e -- 1 + 1
) end in errors described above.Example code
The text was updated successfully, but these errors were encountered: