Check symbol kind before indexing constant qualifiers - #265
Closed
mindaugasrukas wants to merge 1 commit into
Closed
mindaugasrukas wants to merge 1 commit into
mindaugasrukas wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
includethat references it currently callsasClassOrModuleRef()before checking the symbol kind, triggering thekind() == Kind::ClassOrModuleassertion.The included regression reproduces this with:
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
./bazel test --config=dev --jobs=6 //test/scipwith this patch alone: all 60 tests passed.//main:scip-rubywith--config=devand 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.