Feat/oxabl lint phase5#51
Merged
Merged
Conversation
New `oxabl_lint` workspace crate depending only on `oxabl_semantic` +
`oxabl_common` + `oxabl_ast`. Public surface: `lint_file(program, sem,
ctx) -> Vec<Diagnostic>` plus per-rule `run` functions for callers
who need finer control.
Rules shipped:
- **LINT0001 `undefined-symbol`** — fires on `Resolution::Unresolved
{ reason: NotInScope }` references. Skips External (USING /
cross-file) and NoSchema (schema-absent) reasons.
- **LINT0002 `unused-variable`** — fires on Variables / Parameters
with `read_count == 0`. Skip-list: OUTPUT + INPUT-OUTPUT parameters
(writing is the contract), parameters declared inside INTERFACE
bodies or ABSTRACT methods, SHARED / NEW SHARED / NEW GLOBAL
SHARED variables.
- **LINT0003 `unknown-table-or-field`** — fires on FieldAccess with
unresolved qualifier/field when `schema_loaded == true`. Emits zero
diagnostics when schema is absent (matches R7). Effectively a
partial no-op in v1 pending schema-backed field lookup, but the
rule + tests pin the expected semantics.
- **LINT0004 `type-mismatch-assignment`** — fires on assignments whose
RHS is not `assignable` to the LHS, or narrowing-warning per
`is_narrowing_warning`. Covers `Assignment`, `Assign`, and
`DEFINE VARIABLE ... INITIAL expr`. Skips Unknown/Error (lattice
bottom / poison) and External references. Widening silent;
Decimal→Integer/Int64→Integer silent per ABL idiom; Longchar→Character
and Datetime→Date warn; class identity enforced; cross-file Class
stays Unknown and is silent.
`NodeIndexVec::insert` now guards against `NodeId::DUMMY` — hand-
constructed AST in tests keyed `u32::MAX` into the side table, which
resized the backing vec to 2^32 slots (OOM). Silently ignoring DUMMY
makes test AST safe without sprinkling NodeId minters everywhere.
Tests: 40 new unit tests across the four rules (all `assert_eq\!` on
diagnostic code/severity/message substring). Workspace total 893 → 933
passing, all green. `cargo clippy --workspace --tests -- -D warnings`
clean.
Deferred to Phase 6: `corpus_lint_audit` binary that runs the four
rules across a sampled pcna-erp subset and emits a TSV baseline. Waits
on Phase 6's analyze CLI wiring.
Co-Authored-By: Claude Opus 4.7 (1M context) <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.
No description provided.