Skip to content

Feat/oxabl lint phase5#51

Merged
evanbrobertson merged 2 commits into
masterfrom
feat/oxabl-lint-phase5
May 1, 2026
Merged

Feat/oxabl lint phase5#51
evanbrobertson merged 2 commits into
masterfrom
feat/oxabl-lint-phase5

Conversation

@evanbrobertson
Copy link
Copy Markdown
Contributor

No description provided.

evanbrobertson and others added 2 commits April 17, 2026 23:48
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>
@evanbrobertson evanbrobertson merged commit b98be1b into master May 1, 2026
5 checks passed
@evanbrobertson evanbrobertson deleted the feat/oxabl-lint-phase5 branch May 1, 2026 01:49
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.

1 participant