Skip to content
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-13208] LLDB fails to evaluate expressions inside class-bound protocol extensions #4423

Closed
augusto2112 opened this issue Jul 13, 2020 · 2 comments
Assignees
Labels
bug LLDB for Swift

Comments

@augusto2112
Copy link

@augusto2112 augusto2112 commented Jul 13, 2020

Previous ID SR-13208
Radar None
Original Reporter @augusto2112
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s LLDB for Swift
Labels Bug
Assignee @augusto2112
Priority Medium

md5: cf5cfd21acc58d5eb0b8c94e4b580a55

Issue Description:

LLDB fails to run any expression inside a default implementation of a class-bound protocol where there are no references to self.

Minimal example :

class C : CP {}

protocol CP : class {
  func foo()
}
extension CP {
  func foo() {
    print(1) // breakpoint here
  }
}

C().foo() 

LLDB:

b test.swift:8
e 1 // (evaluate anything here) 

Output:

error: <EXPR>:4:3: error: 'mutating' isn't valid on methods in classes or class-bound protocols
  mutating func $__lldb_wrapped_expr_0(_ $__lldb_arg : UnsafeMutablePointer<Any>) {
  ^~~~~~~~~ 
@augusto2112
Copy link
Author

@augusto2112 augusto2112 commented Jul 13, 2020

@vedantk @adrian-prantl I stumbled into this problem when working on another bug. The problem happens because of the logic that decides what the function's decorator should be.

const char *func_decorator = "";
if (static_method) {
  if (is_class)
    func_decorator = "final class";
  else
    func_decorator = "static";
} else if (is_class && !weak_self) { // is_class is false
  func_decorator = "final";
} else {
  func_decorator = "mutating";
} 

@augusto2112
Copy link
Author

@augusto2112 augusto2112 commented Dec 29, 2020

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug LLDB for Swift
Projects
None yet
Development

No branches or pull requests

1 participant