Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions objc/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,11 @@ func respondsTo(goID uintptr, sel unsafe.Pointer) bool {
if mi.required {
return true
}
// invalid hasFunc means no HasXXX method, but the XXX method does exist.
// this indicates the optional method is implemented by this implementation.
if !mi.hasFunc.IsValid() {
return true
}

return mi.hasFunc.Call([]reflect.Value{v})[0].Bool()
}
Expand Down
Loading