fix: filter non-importable targets from conflict resolution#160
Open
tylerprete wants to merge 1 commit into
Open
fix: filter non-importable targets from conflict resolution#160tylerprete wants to merge 1 commit into
tylerprete wants to merge 1 commit into
Conversation
…tion When both a scala_binary and scala_library exist in the same package with overlapping source globs, the binary could incorrectly win dependency resolution. While isImportable() correctly prevents binary targets from registering exports, the resolve phase's conflict resolution had no filtering for non-importable targets. Add filterNonImportableConflicts() which removes binary/test symbols from consideration during conflict resolution. Library targets always win over binary/test targets for the same symbol. Fixes stackb#159 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Fixes #159.
When both a
scala_binaryandscala_libraryexist in the same package with overlapping source globs, the binary could incorrectly win dependency resolution. WhileisImportable()correctly prevents binary targets from registering exports, the resolve phase's conflict resolution had no filtering for non-importable targets — it selected arbitrarily without checking target type.This PR adds
filterNonImportableConflicts()inResolveImports()which removes binary/test symbols from consideration during conflict resolution. The key behaviors:scala_libraryandscala_binaryboth provide the same symbol, the library is chosen.Symbolstructs are allocated to avoid mutating the shared trie state.Test plan
filterNonImportableConflicts()covering all cases://language/scala:scala_testsuite passes//pkg/resolver:resolver_testsuite passes🤖 Generated with Claude Code