Skip to content
Open
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
2 changes: 1 addition & 1 deletion scip_indexer/SCIPIndexer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ class SCIPState {
ast::ExpressionPtr &constantLitExpr) {
auto *expr = &constantLitExpr;
while (auto *constantLit = ast::cast_tree<ast::ConstantLit>(*expr)) {
if (constantLit->symbol.exists() && constantLit->symbol.asClassOrModuleRef().exists()) {
if (constantLit->symbol.exists() && constantLit->symbol.isClassOrModule() && constantLit->symbol.asClassOrModuleRef().exists()) {
core::Context ctx(gs, constantLit->symbol, file);
auto status = this->saveReference(ctx, GenericSymbolRef::classOrModule(constantLit->symbol),
/*overrideType*/ std::nullopt, constantLit->loc, 0);
Expand Down
4 changes: 4 additions & 0 deletions test/scip/testdata/inheritance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@ def write_f_plus_1(a)
end
end

Z5 = Object
class Z6 < Z5
end

9 changes: 9 additions & 0 deletions test/scip/testdata/inheritance.snapshot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,12 @@ def write_f_plus_1(a)
end
end

Z5 = Object
#^^ definition [..] Z5.
#relation reference=[..] Object#
#^^^^^^^^^^^ reference [..] Z5.
# ^^^^^^ reference [..] Object#
class Z6 < Z5
# ^^ definition [..] Z6#
end

Loading