fix(lint): add tests for ::: (unhide) visibility#57
Merged
julienduchesne merged 2 commits intomasterfrom Feb 27, 2026
Merged
Conversation
…ors and false positives Object fields with ::: visibility (Jsonnet "unhide" operator) could trigger unexpected behaviour in jrsonnet-lint. Add a test fixture and inline unit tests covering: - simple `attribute::: 'value'` must not produce parse errors or diagnostics - a local variable used only in a ::: field value must not be reported as unused - `field+:::` (merge + unhide) must parse and lint cleanly Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Benchmark Results
Full results available in workflow artifacts. Benchmark run on commit |
…sing `TS![: :: :::]` does not include COLONCOLONCOLON because Rust tokenizes `:::` as two token trees (`::` + `:`) rather than one. The TS! macro iterates over each token tree separately, so the `::: ` part maps to `COLONCOLON` + `COLON` — COLONCOLONCOLON is never added to the set. Introduce a `VISIBILITY_SET` constant built with `SyntaxKindSet::new` to explicitly include all three visibility tokens (`:`, `::`, `:::`), and use it everywhere the old `TS![: :: :::]` was used. Co-Authored-By: Claude Sonnet 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
testdata/clean/triple_colon_visibility.jsonnetcovering object fields with:::(Jsonnet "unhide") visibilityjrsonnet-lint/src/lib.rs:lint_snippet_triple_colon_visibility_no_parse_error—attribute::: 'value'must not produce parse errors or diagnosticslint_snippet_triple_colon_local_used_no_false_positive— a local used only in a:::field value must not be reported as unusedlint_snippet_triple_colon_plus_modifier_no_parse_error—field+:::(merge + unhide) must parse and lint cleanlyTest plan
cargo check --tests -p jrsonnet-lintpasses (confirms code compiles)cargo test -p jrsonnet-lintpasses on CI (all three new tests green)🤖 Generated with Claude Code