Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions lib/IDE/IDERequests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ bool CursorInfoResolver::tryResolve(ValueDecl *D, TypeDecl *CtorTyRef,
IsDynamic = true;
ide::getReceiverType(BaseE, ReceiverTypes);
}
} else if (ExprStack.empty() && isDeclOverridable(D)) {
// We aren't in a call (otherwise we would have an expression stack wouldn't
// be empty), so we're at the declaration of an overridable declaration.
// Mark the declaration as dynamic so that jump-to-definition can offer to
// jump to any declaration that overrides this declaration.
IsDynamic = true;
ReceiverTypes.push_back(D->getDeclContext()->getSelfNominalTypeDecl());
}

if (Data)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
protocol MyProto {
// RUN: %sourcekitd-test -req=cursor -pos=%(line + 1):9 %s -- %s | %FileCheck %s
func foo()
}

// CHECK: DYNAMIC
// CHECK: RECEIVERS BEGIN
// CHECK: s:41cursor_of_protocol_requirement_is_dynamic7MyProtoP
// CHECK: RECEIVERS END

class ClassA: MyProto {
func foo() {}
}

class ClassB: MyProto {
func foo() {}
}