Files
lucisv/crates/vlog_linter/tests/cases/declarations.lint
T
lucioandClaude Fable 5 cebeff45b4 Linter expansion, wave 1: severities end to end, per-rule editor toggles generated from the registry, and nineteen Error/Warning-class rules
TODO section 33. Every rule states a Severity (error: would likely fail
to compile or elaborate, or silently mis-synthesize; warning: a probable
bug; style), printed in lucisv check text and JSON, mapped to
ERROR/WARNING/INFORMATION in the editor, grouped in --rules-doc, and
accepted by --select/--ignore and [lint] as a class word. VS Code gains
lucisv.lint.severity.{error,warning,style} and one tri-state
lucisv.lint.rules.<rule> per rule (default/on/off - a client sends
every key, so a boolean cannot say unset), generated by
vlog_linter::vscode with a drift test, and lint::enabled_rules is the
one documented ladder: defaults -> select -> class switches -> per-rule
-> ignore. Nineteen new rules (17 -> 36), one file each with true
positives and near-misses: Error - mismatched-labels,
duplicate-declaration (Semantics::duplicates(), additive),
undeclared-identifier (with a project; silent for macro text, included
fragments, hierarchical tails, any name another file mentions),
unknown-port, unknown-parameter; Warning - forbid-defparam,
invalid-system-task-function, truncated-numeric-literal,
undersized-binary-literal (safe fix), suspicious-semicolon,
packed-dimensions-range-ordering, module-port, module-parameter,
explicit-function-task-parameter-type, plusarg-assignment,
instance-shadowing, forbid-negative-array-dim, void-cast,
incomplete-assignment. Every false-positive class found on opentitan
closed with a named test; 3 383 tests / 48 binaries; corpus 814/820
and byte-identical (formatter untouched); vsix smoke OK.

docs/features/linter-expansion-1/README.md.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-09-03 17:49:03 -07:00

84 lines
1.8 KiB
Plaintext

# a packed dimension that counts upwards
#select packed-dimensions-range-ordering
module m;
logic [0:7] up;
//^ 9 packed-dimensions-range-ordering
logic [0:WIDTH-1] also_up;
//^ 9 packed-dimensions-range-ordering
endmodule
====
# the decreasing form, a one-bit range, and an unpacked array
#select packed-dimensions-range-ordering
module m;
logic [7:0] down;
logic [WIDTH-1:0] symbolic;
logic [0:0] one_bit;
logic [LO:HI] unknowable;
logic ascending_array [0:3];
endmodule
====
# a negative constant written into a dimension
#select forbid-negative-array-dim
module m;
logic [-1:0] v;
//^ 10 forbid-negative-array-dim
logic q [-1];
//^ 12 forbid-negative-array-dim
endmodule
====
# a subtraction is not a negative literal
#select forbid-negative-array-dim
module m;
logic [WIDTH-1:0] v;
logic q [DEPTH];
parameter int P = -1;
endmodule
====
# an untyped formal is a one-bit logic
#select explicit-function-task-parameter-type
module m;
function void f(input a);
//^ 19 explicit-function-task-parameter-type
endfunction
endmodule
====
# a continuation formal inherits the type in force
#select explicit-function-task-parameter-type
module m;
function void f(input int a, b);
endfunction
task t(input logic [7:0] c);
endtask
endmodule
====
# a positional connection list of more than one port
#select module-port
module m;
sub u_sub (a, b, c);
//^ 7 module-port
endmodule
====
# named connections, a wildcard, and a single positional one
#select module-port
module m;
sub u1 (.a(x), .b(y));
sub u2 (.*);
sub u3 (a);
sub u4 ();
endmodule
====
# more than one positional parameter override
#select module-parameter
module m;
sub #(8, 4) u_sub ();
//^ 3 module-parameter
endmodule
====
# named overrides, and a single positional one
#select module-parameter
module m;
sub #(.Width(8), .Depth(4)) u1 ();
sub #(8) u2 ();
sub u3 ();
endmodule