Skip to content

fix: Don't emit SymbolInformation for local defs. #32

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

Merged
merged 1 commit into from
Jul 20, 2022
Merged
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
15 changes: 9 additions & 6 deletions scip_indexer/SCIPIndexer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,14 @@ class SCIPState {

private:
absl::Status saveDefinitionImpl(const core::GlobalState &gs, core::FileRef file, const string &symbolString,
core::Loc occLoc) {
core::Loc occLoc, bool isLocal) {
ENFORCE(!symbolString.empty());
occLoc = trimColonColonPrefix(gs, occLoc);
scip::SymbolInformation symbolInfo;
symbolInfo.set_symbol(symbolString);
this->symbolMap[file].push_back(symbolInfo);
if (!isLocal) {
scip::SymbolInformation symbolInfo;
symbolInfo.set_symbol(symbolString);
this->symbolMap[file].push_back(symbolInfo);
}

scip::Occurrence occurrence;
occurrence.set_symbol(symbolString);
Expand Down Expand Up @@ -496,7 +498,8 @@ class SCIPState {
if (this->cacheOccurrence(gs, file, occ, scip::SymbolRole::Definition)) {
return absl::OkStatus();
}
return this->saveDefinitionImpl(gs, file, occ.toString(gs, file), core::Loc(file, occ.offsets));
return this->saveDefinitionImpl(gs, file, occ.toString(gs, file), core::Loc(file, occ.offsets),
/*isLocal*/ true);
}

// Save definition when you have a sorbet Symbol.
Expand All @@ -518,7 +521,7 @@ class SCIPState {

auto occLoc = loc.has_value() ? core::Loc(file, loc.value()) : symRef.symbolLoc(gs);

return this->saveDefinitionImpl(gs, file, symbolString, occLoc);
return this->saveDefinitionImpl(gs, file, symbolString, occLoc, /*isLocal*/ false);
}

absl::Status saveReference(const core::GlobalState &gs, core::FileRef file, OwnedLocal occ, int32_t symbol_roles) {
Expand Down