Skip to content

Check symbol kind before indexing constant qualifiers - #265

Closed
mindaugasrukas wants to merge 1 commit into
sourcegraph:scip-ruby/masterfrom
mindaugasrukas:fix/dynamic-constant-qualifiers
Closed

mindaugasrukas wants to merge 1 commit into
sourcegraph:scip-ruby/masterfrom
mindaugasrukas:fix/dynamic-constant-qualifiers

Conversation

@mindaugasrukas

Copy link
Copy Markdown

Check isClassOrModule() before indexing a constant as a class/module qualifier. This replaces the cast in the condition with a symbol-kind check.

Motivation

A constant assigned from a method call can be represented as a field symbol. Indexing an include that references it currently calls asClassOrModuleRef() before checking the symbol kind, triggering the kind() == Kind::ClassOrModule assertion.

The included regression reproduces this with:

module Helpers
  Dynamic = build_helpers

  class Client
    include Dynamic
  end
end

The kind check lets indexing continue while preserving the ordinary constant reference. The regression also covers a statically declared module referenced through Helpers::Static.

Test plan

  • Confirmed the regression triggers the class/module assertion before the fix.
  • Added a snapshot test covering dynamic constants and static module qualifiers.
  • Ran ./bazel test --config=dev --jobs=6 //test/scip with this patch alone: all 60 tests passed.
  • Built //main:scip-ruby with --config=dev and verified the dynamic-include reproduction produces an index accepted by the SCIP decoder.

Validation ran on macOS ARM64 using the macOS 14.4 SDK with the repository's LLVM 15 toolchain; the SDK selection was local to the validation checkout and is not part of this patch.

@emidoots
emidoots deleted the branch sourcegraph:scip-ruby/master September 24, 2026 19:36
@emidoots emidoots closed this Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants