diff --git a/scip_indexer/SCIPIndexer.cc b/scip_indexer/SCIPIndexer.cc index 7b33c0602..dc54f653b 100644 --- a/scip_indexer/SCIPIndexer.cc +++ b/scip_indexer/SCIPIndexer.cc @@ -486,7 +486,7 @@ class SCIPState { ast::ExpressionPtr &constantLitExpr) { auto *expr = &constantLitExpr; while (auto *constantLit = ast::cast_tree(*expr)) { - if (constantLit->symbol.exists() && constantLit->symbol.asClassOrModuleRef().exists()) { + if (constantLit->symbol.exists() && constantLit->symbol.isClassOrModule()) { core::Context ctx(gs, constantLit->symbol, file); auto status = this->saveReference(ctx, GenericSymbolRef::classOrModule(constantLit->symbol), /*overrideType*/ std::nullopt, constantLit->loc, 0); diff --git a/test/scip/testdata/dynamic_constant_qualifiers.rb b/test/scip/testdata/dynamic_constant_qualifiers.rb new file mode 100644 index 000000000..f7519a910 --- /dev/null +++ b/test/scip/testdata/dynamic_constant_qualifiers.rb @@ -0,0 +1,16 @@ +# typed: true + +module Helpers + Dynamic = build_helpers + + class Client + include Dynamic + end + + module Static + end + + class OtherClient + include Helpers::Static + end +end diff --git a/test/scip/testdata/dynamic_constant_qualifiers.snapshot.rb b/test/scip/testdata/dynamic_constant_qualifiers.snapshot.rb new file mode 100644 index 000000000..e2c188f01 --- /dev/null +++ b/test/scip/testdata/dynamic_constant_qualifiers.snapshot.rb @@ -0,0 +1,36 @@ + # typed: true + +#⌄ enclosing_range_start [..] Helpers# + module Helpers +# ^^^^^^^ definition [..] Helpers# + Dynamic = build_helpers +# ^^^^^^^ definition [..] Helpers#Dynamic. +# ^^^^^^^^^^^^^^^^^^^^^^^ reference [..] Helpers#Dynamic. + +# ⌄ enclosing_range_start [..] Helpers#Client# + class Client +# ^^^^^^ definition [..] Helpers#Client# + include Dynamic +# ^^^^^^^ reference [..] Module#include(). +# ^^^^^^^ reference [..] Helpers#Dynamic. + end +# ⌃ enclosing_range_end [..] Helpers#Client# + +# ⌄ enclosing_range_start [..] Helpers#Static# + module Static +# ^^^^^^ definition [..] Helpers#Static# + end +# ⌃ enclosing_range_end [..] Helpers#Static# + +# ⌄ enclosing_range_start [..] Helpers#OtherClient# + class OtherClient +# ^^^^^^^^^^^ definition [..] Helpers#OtherClient# + include Helpers::Static +# ^^^^^^^ reference [..] Module#include(). +# ^^^^^^^ reference [..] Helpers# +# ^^^^^^ reference [..] Helpers#Static# +# ^^^^^^ reference [..] Helpers#Static# + end +# ⌃ enclosing_range_end [..] Helpers#OtherClient# + end +# ⌃ enclosing_range_end [..] Helpers#