vlog_parser: a direction-less first ANSI port parses
ci / checks (push) Successful in 42s
ci / corpus (push) Successful in 20s

IEEE 1800 §23.2.2.2 allows an ANSI header's first port to carry no
direction — the normal spelling for interface ports — but
parse_port_list classified any leading identifier as a non-ANSI list
and errored on what followed. One clause fixes it: a leading Ident is
ANSI when the parser's existing type-then-name lookahead
(at_typed_declarator, which already walks pkg:: chains, #() overrides
and packed dims) or the new 4-token modport lookahead (ident.ident
ident) says so; the complement is exactly the old non-ANSI list, and
macro-led lists never enter the clause. bus_if.mp was a second,
independent gap (it parsed in no position before) and is glued into
DataType::name the way pkg::t already was. No AST change — the new
ports are AnsiPort { dir: None }, the shape later ports always had.
Two match-widenings ride along: bind_data_type and type_def's
type_span read the pre-dot half as the type, and the modport half is
bindable by nothing — pinned for rename by QA.

The safety case, established twice (dev, then QA independently via a
worktree build): corpus 813/820 both sides, TSVs byte-identical, and
all 820 formatted outputs SHA-256-identical across the change; zero
snapshot churn; verify.rs untouched. QA's boundary AST-diff harness
(~20 shapes at the classification edge) and a 50-file
direction-stripping fuzz sweep found no misfire. The
previously-blocked fixtures flipped to first-port order; instantiate
now plans interface-typed port lists instead of refusing. The two
remaining unsupported shapes (generic interface ports, virtual
modport declarations) are pinned by a lead-added test so a future
round changes them on purpose.

24 tests added (dev 21 + QA 2 + lead 1).

docs/features/ansi-first-port/README.md

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
lucioandClaude Fable 5 committed 2026-08-26 20:49:16 -07:00
1 parent c9817a6840
commit 24e8eab78b
10 files changed
+851 -31

No files matched your search

+3 -1
View File
@@ -791,7 +791,9 @@ and are not gaps.
`vlog_semantic` should report an unqualified lexical miss as an
external candidate (stood in for by a fenced index lookup), and
`vlog_parser` cannot parse an ANSI header whose first port has no
direction.
direction. Both landed: the first on 2026-08-26 by
`docs/features/overlay-promotion/README.md`, the second the same day by
`docs/features/ansi-first-port/README.md`.
- [x] **Linked editing range** — edit `module m` and its
`endmodule : m` label together (`end : label`, `endfunction : name`,
etc.). A genuinely good fit for SV's closing labels.
+50 -8
View File
@@ -139,7 +139,11 @@ struct Site<'a> {
/// with the `::` glued — so the whole name is tried first.
fn type_span(semantics: &Semantics, site: &Site) -> Option<TextRange> {
let tail = site.name.rsplit("::").next().unwrap_or(site.name);
let matches = |name: &str| name == site.name || name == tail;
// An interface port carries its modport in the same name (`bus_if.mp`,
// IEEE 1800 §25.4). The interface before the dot is the type, and is what
// the binder recorded.
let head = tail.split_once('.').map_or(tail, |(iface, _)| iface);
let matches = |name: &str| name == site.name || name == tail || name == head;
semantics
.references()
.iter()
@@ -466,20 +470,58 @@ endmodule
#[test]
fn an_interface_port_reaches_its_interface() {
// The interface port is written second on purpose: a header whose
// *first* port carries no direction does not parse today, which is
// the parser's own limitation and is recorded in the feature
// README's Handshakes.
// The interface port is written *first*, with no direction, which is
// how an interface port is normally spelled and what
// `docs/features/ansi-first-port/README.md` made parse. Both
// orderings are asserted: the shape that used to be the only one
// that parsed must keep working.
let text = "\
interface bus_if;
endinterface
module m (input logic clk, bus_if bus);
module m (bus_if bus, input logic clk);
endmodule
module n (input logic clk, bus_if bus);
endmodule
";
let (ws, uri) = document(text);
assert_eq!(jumps(&ws, &uri, at(text, "bus)")), [(0, 10)]);
assert!(type_definition(&ws, &uri, at(text, "clk")).is_empty(), "`logic` is a built-in");
assert_eq!(jumps(&ws, &uri, at(text, "bus,")), [(0, 10)], "the direction-less first port");
assert_eq!(jumps(&ws, &uri, at(text, "bus)")), [(0, 10)], "and a later one");
assert!(type_definition(&ws, &uri, at(text, "clk,")).is_empty(), "`logic` is a built-in");
}
#[test]
fn a_modport_qualified_port_reaches_its_interface() {
// `bus_if.mp bus` (IEEE 1800 §25.4): the parser glues the modport
// onto the type name, and `bind_data_type` takes the jump to the
// interface from the half before the dot.
let text = "\
interface bus_if;
modport mp (input a);
endinterface
module m (bus_if.mp bus);
endmodule
";
let (ws, uri) = document(text);
assert_eq!(jumps(&ws, &uri, at(text, "bus)")), [(0, 10)], "the declarator");
assert_eq!(jumps(&ws, &uri, at(text, "bus_if.mp")), [(0, 10)], "and the type name itself");
}
#[test]
fn a_package_scoped_first_port_reaches_its_typedef() {
let text = "\
package my_pkg;
typedef enum logic {A, B} state_t;
endpackage
module m (my_pkg::state_t s, output logic q);
endmodule
";
let (ws, uri) = document(text);
assert_eq!(jumps(&ws, &uri, at(text, "s,")), [(1, 28)]);
assert!(type_definition(&ws, &uri, at(text, "q)")).is_empty(), "`logic` is a built-in");
}
#[test]
@@ -194,3 +194,52 @@ module m
import c::u;
#(parameter int W = 8) (input clk_i);
endmodule
====
# a direction-less first ANSI port: the normal spelling of an interface port
module m(bus_if bus,input logic clk);endmodule
----
module m (bus_if bus, input logic clk);
endmodule
====
# the same port with a modport, and alone in the list
module m( bus_if.mp bus );endmodule
----
module m (bus_if.mp bus);
endmodule
====
# a package-scoped type as the first port
module m(my_pkg::state_t s,output logic q);endmodule
----
module m (my_pkg::state_t s, output logic q);
endmodule
====
# an interface header takes the same list
interface i(bus_if.mp bus,input logic clk);endinterface
----
interface i (bus_if.mp bus, input logic clk);
endinterface
====
# a typed first port with packed dimensions and a parameterized one
module m(word_t [3:0] d,item #(A, B) req,input a);endmodule
----
module m (word_t [3:0] d, item #(A, B) req, input a);
endmodule
====
# a direction-less first port in a list too wide for one line
module wide_module_name_here(bus_if.mp bus_interface_port,my_pkg::state_t current_state_in,input logic clock_signal,output logic [31:0] result_word_out);endmodule
----
module wide_module_name_here (
bus_if.mp bus_interface_port,
my_pkg::state_t current_state_in,
input logic clock_signal,
output logic [31:0] result_word_out
);
endmodule
====
# a name-only non-ANSI list is untouched by the disambiguation
module m(a,b);input a;output b;endmodule
----
module m (a, b);
input a;
output b;
endmodule
+199 -1
View File
@@ -2412,6 +2412,16 @@ impl<'a> Parser<'a> {
|| t.is_kw("ref")
|| TYPE_KEYWORDS.contains(&t.text.as_str())
|| NET_KEYWORDS.contains(&t.text.as_str())
// A direction is optional on the *first* ANSI port too (IEEE
// 1800 §23.2.2.2), and an interface port is normally written
// with none at all: `module m (bus_if bus, input logic clk);`.
// Such a port opens with a plain identifier, exactly as a
// non-ANSI name list does, so the two are told apart by what
// follows it — a second identifier (past any `pkg::` chain,
// `#( ... )` override or packed dimensions) means a type and a
// name, while the `,` or `)` of `module m (a, b);` does not.
|| (t.kind == TokenKind::Ident
&& (self.at_typed_declarator() || self.at_modport_port()))
};
if ansi {
let mut ports = Vec::new();
@@ -2484,7 +2494,11 @@ impl<'a> Parser<'a> {
None
}
};
let ty = self.parse_opt_data_type()?;
let ty = if self.at_modport_port() {
self.parse_modport_port_type()?
} else {
self.parse_opt_data_type()?
};
let Name { text: name, span: name_span } = self.expect_name()?;
let unpacked = self.parse_dims()?;
let default = if self.eat_sym("=") { Some(self.parse_expr()?) } else { None };
@@ -2493,6 +2507,28 @@ impl<'a> Parser<'a> {
Ok(AnsiPort { meta, dir, net, ty, name, name_span, unpacked, default, comma: false, span })
}
/// Does the cursor sit on an interface port that names a modport,
/// `bus_if.mp bus` (IEEE 1800 §25.4)? Only a *port header* is spelled this
/// way — after an identifier anywhere else a `.` opens a member access —
/// so the shape is recognized here rather than in `parse_opt_data_type`.
fn at_modport_port(&self) -> bool {
self.cur().kind == TokenKind::Ident
&& self.nth(1).is_sym(".")
&& self.nth(2).kind == TokenKind::Ident
&& self.nth(3).kind == TokenKind::Ident
}
/// The `bus_if.mp` of an interface port, as its type. The modport is glued
/// onto the interface name exactly as a `pkg::` qualifier is, so every
/// consumer that prints or scans a type name still sees one string.
fn parse_modport_port_type(&mut self) -> PResult<DataType> {
let mut name = self.expect_ident()?;
self.expect_sym(".")?;
name.push('.');
name.push_str(&self.expect_ident()?);
Ok(DataType { name, ..DataType::default() })
}
/// Parse a possibly-implicit data type. Stops before the declarator name.
fn parse_opt_data_type(&mut self) -> PResult<DataType> {
let mut ty = DataType::default();
@@ -5738,6 +5774,168 @@ mod tests {
assert_eq!(ports.iter().map(|p| p.comma).collect::<Vec<_>>(), vec![true, false]);
}
// ------------------------------------------------------------------
// A direction-less first ANSI port (IEEE 1800 §23.2.2.2)
// `docs/features/ansi-first-port/README.md`
// ------------------------------------------------------------------
/// The `(dir, type, name)` of every port of an ANSI header.
fn ansi_ports(src: &str) -> Vec<(String, String, String)> {
let file = parse_ok(src);
let m = module_of(&file);
let PortList::Ansi(ports) = &m.ports else { panic!("expected ANSI ports in {src:?}") };
ports
.iter()
.map(|p| (p.dir.clone().unwrap_or_default(), p.ty.name.clone(), p.name.clone()))
.collect()
}
fn cell(dir: &str, ty: &str, name: &str) -> (String, String, String) {
(dir.to_string(), ty.to_string(), name.to_string())
}
#[test]
fn an_interface_typed_first_port_needs_no_direction() {
assert_eq!(
ansi_ports("module m (bus_if bus, input logic clk);\nendmodule\n"),
[cell("", "bus_if", "bus"), cell("input", "logic", "clk")]
);
assert_eq!(
ansi_ports("module m (bus_if bus);\nendmodule\n"),
[cell("", "bus_if", "bus")],
"alone in the list"
);
assert_eq!(
ansi_ports("interface i (bus_if bus);\nendinterface\n"),
[cell("", "bus_if", "bus")],
"an interface header is the same node and the same list"
);
}
#[test]
fn a_modport_qualified_port_keeps_the_modport_in_its_type() {
// IEEE 1800 §25.4. The modport is glued onto the interface name, the
// way a `pkg::` qualifier already is, so nothing downstream needs a
// second field to print or scan.
assert_eq!(
ansi_ports("module m (bus_if.mp bus);\nendmodule\n"),
[cell("", "bus_if.mp", "bus")]
);
assert_eq!(
ansi_ports("module m (input logic clk, bus_if.mp bus);\nendmodule\n"),
[cell("input", "logic", "clk"), cell("", "bus_if.mp", "bus")],
"later in the list too, which never parsed either"
);
}
#[test]
fn a_package_scoped_first_port_is_a_type_and_a_name() {
assert_eq!(
ansi_ports("module m (my_pkg::state_t s);\nendmodule\n"),
[cell("", "my_pkg::state_t", "s")]
);
assert_eq!(
ansi_ports("module m (my_pkg::state_t s, output logic q);\nendmodule\n"),
[cell("", "my_pkg::state_t", "s"), cell("output", "logic", "q")]
);
}
#[test]
fn a_direction_less_first_port_mixes_with_directed_ones_in_both_orders() {
assert_eq!(
ansi_ports("module m (state_t s, input a, output logic q);\nendmodule\n"),
[cell("", "state_t", "s"), cell("input", "", "a"), cell("output", "logic", "q")]
);
assert_eq!(
ansi_ports("module m (input a, state_t s);\nendmodule\n"),
[cell("input", "", "a"), cell("", "state_t", "s")],
"the ordering that always parsed is unchanged"
);
}
#[test]
fn a_typed_first_port_carries_its_dimensions_like_any_other() {
assert_eq!(
ansi_ports("module m (word_t [3:0] d, input a);\nendmodule\n"),
[cell("", "word_t", "d"), cell("input", "", "a")],
"packed dimensions sit between the type and the name"
);
assert_eq!(
ansi_ports("module m (item #(A, B) req);\nendmodule\n"),
[cell("", "item", "req")],
"a parameterized type, whose `#( ... )` is kept in the type"
);
}
#[test]
fn a_name_only_port_list_is_still_non_ansi() {
// The disambiguation must not eat the non-ANSI list: what follows the
// first identifier is a `,` or a `)`, not a second name.
let file = parse_ok("module m (a, b, c);\ninput a;\ninput b;\noutput c;\nendmodule\n");
let m = module_of(&file);
let PortList::NonAnsi(ports) = &m.ports else { panic!("expected a non-ANSI port list") };
assert_eq!(ports.iter().map(|p| p.name.as_str()).collect::<Vec<_>>(), vec!["a", "b", "c"]);
assert_eq!(ports.iter().map(|p| p.comma).collect::<Vec<_>>(), vec![true, true, false]);
let file = parse_ok("module m (a);\ninput a;\nendmodule\n");
let PortList::NonAnsi(ports) = &module_of(&file).ports else { panic!("non-ANSI") };
assert_eq!(ports.len(), 1, "a one-name list has no comma to look past either");
}
#[test]
fn the_other_port_list_spellings_are_untouched() {
let file = parse_ok("module m ();\nendmodule\n");
assert!(matches!(module_of(&file).ports, PortList::Empty), "empty parens");
let file = parse_ok("module m;\nendmodule\n");
assert!(matches!(module_of(&file).ports, PortList::None), "no list at all");
assert_eq!(
ansi_ports("module m (input a, b);\nendmodule\n"),
[cell("input", "", "a"), cell("", "", "b")],
"a continuation port still inherits its direction from the one before"
);
}
#[test]
fn what_is_not_a_bare_identifier_classifies_exactly_as_it_did() {
// The clause only fires on a `TokenKind::Ident`, so a macro-produced
// list (a `Directive` token) and an escaped name are read the way
// they always were, and a comment between the name and its comma is
// trivia that the lookahead never sees.
for src in [
"module m (`PORT_LIST);\nendmodule\n",
"module m (\\esc_name , b);\nendmodule\n",
"module m (a /* why */, b);\nendmodule\n",
] {
let file = parse_ok(src);
assert!(
matches!(module_of(&file).ports, PortList::NonAnsi(_)),
"still a non-ANSI list: {src:?}"
);
}
}
#[test]
fn a_broken_header_still_reports_its_own_token() {
// Recovery is unchanged: neither new shape swallows a genuinely
// broken list, and the diagnostic still names what blocked it.
assert!(parse_err("module m (bus_if bus;\nendmodule\n").contains("expected `)`"));
assert!(parse_err("module m (a[3], b);\nendmodule\n").contains("expected `)`"));
let (file, diags) = crate::parse_source_tolerant("module m (bus_if bus\nendmodule\n");
assert!(!diags.is_empty(), "a header that never closes is still an error");
assert!(!file.items.is_empty(), "and the file is still addressable");
}
#[test]
fn the_two_shapes_left_open_by_ansi_first_port_still_refuse() {
// Pinned so a future round that changes either does it on purpose
// (docs/features/ansi-first-port/README.md, Status): the generic
// `interface` port is a different production wanting a "any
// interface" DataType, and a modport-qualified *declaration* type
// would change how a `.` after an identifier reads everywhere.
assert!(parse_err("module m (interface bus);\nendmodule\n").contains("expected"));
assert!(parse_err("module m;\n virtual bus_if.mp v;\nendmodule\n").contains("expected"));
}
#[test]
fn both_arms_of_an_else_are_ordinary_elements_of_one_list() {
// lucisv does not evaluate the condition: an `ifdef/`else pair simply
+17 -7
View File
@@ -902,14 +902,24 @@ endmodule
}
#[test]
fn an_interface_typed_port_list_is_refused_as_a_parse_failure() {
// The disclosed `vlog_parser` gap: an interface-typed ANSI port
// (`iface_bus.mst bus`) stops the header from parsing, so no module
// is produced at all. The refusal must name the real cause.
fn an_interface_typed_port_list_is_planned_like_any_other() {
// Was the disclosed `vlog_parser` gap: an interface-typed ANSI port
// (`iface_bus.mst bus`) as the first, direction-less element stopped
// the header from parsing, so no module was produced at all and the
// refusal had to name the real cause. `docs/features/ansi-first-port`
// closed it, so the plan is now the ordinary one — an interface port
// has no direction, and its type is the interface (with its modport)
// exactly as written.
let text = "module m (iface_bus.mst bus, input logic clk);\nendmodule\n";
let message = instantiation_plan("m", text, None).expect_err("the parser gap");
assert!(message.contains("does not parse"), "{message}");
assert!(message.contains("line"), "{message}");
let plan = plan(text, "m");
assert_eq!(plan.ports.iter().map(|p| p.name.as_str()).collect::<Vec<_>>(), ["bus", "clk"]);
assert_eq!(plan.ports[0].dir, "");
assert_eq!(plan.ports[0].ty, "iface_bus.mst");
assert_eq!(plan.ports[1].dir, "input");
assert_eq!(plan.ports[1].ty, "logic");
let skeleton = plan.render(&Layout::default());
assert!(skeleton.contains(".bus("), "{skeleton}");
assert!(parses(&skeleton), "{skeleton}");
}
#[test]
+37 -3
View File
@@ -324,9 +324,10 @@ fn an_interface_renames_from_the_declaration_it_types_in_another_file() {
// this reachable: an unqualified type name nothing in the using file
// binds is now an external candidate the workspace answers, so the two
// halves of the rename are one symbol instead of two unrelated words.
// The interface is written in the body, not in the header: an ANSI port
// list whose first port has no direction does not parse yet
// (`docs/features/type-definition/README.md`, Handshake 2).
// The interface is written in the body rather than in the header, which
// is the shape this test has always pinned. The header spelling reaches
// the same reference since `docs/features/ansi-first-port/README.md`, and
// is asserted below as its own arm.
let iface = "interface bus_if;\nendinterface\n";
let top = "module top;\n virtual bus_if vif;\n bus_if other ();\nendmodule\n";
let files = workspace(&[("bus_if.sv", iface), ("top.sv", top)]);
@@ -339,6 +340,39 @@ fn an_interface_renames_from_the_declaration_it_types_in_another_file() {
assert!(after.contains("fabric_if other ()"), "the instantiation too: {after}");
}
#[test]
fn an_interface_renames_through_a_direction_less_ansi_port() {
// The header spelling of the same rename, which needed
// `docs/features/ansi-first-port/README.md` to parse at all: the port is
// first and carries no direction, and its modport travels with the type.
let iface = "interface bus_if;\n modport mp (input a);\nendinterface\n";
let top = "module top (bus_if.mp bus, input logic clk);\nendmodule\n";
let files = workspace(&[("bus_if.sv", iface), ("top.sv", top)]);
let edit =
rename(&files, &path("top.sv"), at(top, "top ", "bus_if"), "fabric_if").expect("renames");
assert!(apply(iface, &edit, &path("bus_if.sv")).contains("interface fabric_if;"));
let after = apply(top, &edit, &path("top.sv"));
assert!(after.contains("module top (fabric_if.mp bus,"), "{after}");
}
#[test]
fn renaming_the_modport_half_of_a_port_type_is_refused() {
// QA attack (`docs/features/ansi-first-port/README.md`): `bus_if.mp bus`
// glues the modport onto the type name, but only the interface half is
// bound (`ItemKind::Modport` is a leaf in `vlog_semantic`, `bind.rs:364`).
// A rename request on the `mp` half must find nothing to rename — never
// silently rename the interface instead, and never corrupt the modport
// spelling.
let iface = "interface bus_if;\n modport mp (input a);\nendinterface\n";
let top = "module top (bus_if.mp bus);\nendmodule\n";
let files = workspace(&[("bus_if.sv", iface), ("top.sv", top)]);
let offset = at(top, "bus_if.", "mp");
let err = rename(&files, &path("top.sv"), offset, "mp2")
.expect_err("the modport half of the type name is not a bound symbol");
assert!(!err.is_empty());
}
// ----------------------------------------------------------------------
// refusals
// ----------------------------------------------------------------------
+10 -2
View File
@@ -1227,8 +1227,16 @@ impl<'a> Binder<'a> {
self.use_name(scope, item, item_span, Target::UnitMember(unit.to_string()));
}
None => {
let ns = crate::scan::name_span(self.src, window, &ty.name);
self.use_name(scope, &ty.name, ns, Target::Type);
// `bus_if.mp bus` — the parser glues an interface port's
// modport onto the type name (IEEE 1800 §25.4). The
// interface is the type; the modport is a member of it,
// and this crate declares no symbol for a modport
// (`ItemKind::Modport` is a leaf here), so the tail is
// left unbound rather than recorded as a name that can
// never resolve.
let name = ty.name.split_once('.').map_or(ty.name.as_str(), |(iface, _)| iface);
let ns = crate::scan::name_span(self.src, window, name);
self.use_name(scope, name, ns, Target::Type);
}
}
}
+40
View File
@@ -458,6 +458,46 @@ fn a_miss_inside_an_extending_class_is_answered_without_losing_its_base() {
assert_eq!(slice(&ws, &sources, &defs[0]), "clk_rst_if");
}
#[test]
fn a_direction_less_first_ansi_port_binds_its_interface_type_cross_file() {
// `docs/features/ansi-first-port/README.md`: the header spelling every
// interface port is really written in. `bind_module`'s ANSI arm sees an
// ordinary `AnsiPort` with no direction, so the type window is the one it
// always was and the name reaches the unit table like any other type miss.
// The modport spelling is the same reference: the parser glues `.mp` onto
// the type name and `bind_data_type` binds the interface half of it.
let sources = [
("bus_if.sv", "interface bus_if;\n modport mp (input a);\nendinterface\n"),
("top.sv", "module top (bus_if bus, input logic clk);\nendmodule\n"),
("sub.sv", "module sub (bus_if.mp bus);\nendmodule\n"),
];
let ws = index(&sources);
for (src, needle) in [(sources[1].1, "bus_if bus"), (sources[2].1, "bus_if.mp")] {
let sem = semantics(src);
assert_eq!(
resolution(&sem, src, needle),
Resolution::ExternalCandidate { paths: vec!["bus_if".to_string()] },
"{needle}"
);
let defs = external_defs(&sem, &ws, src, needle);
assert_eq!(defs.len(), 1, "{needle}: {defs:?}");
assert_eq!(slice(&ws, &sources, &defs[0]), "bus_if");
assert_eq!(defs[0].kind, SymbolKind::Module, "an interface is a Module symbol");
}
// The port itself is still declared, and `clk` beside it too: the shared
// type window never swallowed the declarator.
let sem = semantics(sources[1].1);
let ports: Vec<&str> = sem
.symbols()
.iter()
.filter(|s| s.kind == SymbolKind::Port)
.map(|s| s.name.as_str())
.collect();
assert_eq!(ports, ["bus", "clk"]);
}
#[test]
fn an_inherited_member_the_unit_table_cannot_hold_stays_exactly_what_it_was() {
// The other half of the same shape: an ordinary member miss. The sweep is
+401
View File
@@ -0,0 +1,401 @@
# ansi-first-port
## Goal
An ANSI module header whose **first** port carries no direction did not parse:
`module m (bus_if bus, input logic clk);` became an `Error` item, and so did
`module m (bus_if.mp bus);` and `module m (my_pkg::state_t s);`. IEEE 1800
§23.2.2.2 makes the direction optional on every ANSI port including the first
(it defaults to `inout`, and to whatever the previous port wrote for a
continuation port), and for an *interface* port there is no direction to write
at all — `bus_if bus` is the only spelling there is. This round closes that
gap: the port list is classified ANSI-or-not by what follows the first
identifier rather than by the identifier alone, and an interface port may name
its modport. It was filed as Handshake request 2 of
`docs/features/type-definition/README.md`, whose interface-port tests had to
write the port *second* to have anything to test.
## Assumptions
- **A first port spelled `ident ident` is a type and a name, never two
non-ANSI port names.** SystemVerilog has no port list in which two
identifiers stand side by side without a separator, so the pair is
unambiguous. The non-ANSI list is exactly the case where the first
identifier is followed by `,` or `)`, and that is what the disambiguation
tests for — through the same lookahead (`at_typed_declarator`) that already
decides `pkg::my_t x` from `x[i] = 1` everywhere else in the parser.
- **A `.` after an identifier is a member access everywhere except a port
header.** That is why `bus_if.mp bus` is recognized in `parse_ansi_port` and
not in `parse_opt_data_type`: making the general type parser accept a dotted
name would change how an identifier is read in expression and declaration
positions, which is far more than this gap asks for. `virtual bus_if.mp v;`
(a modport-qualified *virtual interface*, legal per §25.9) is therefore
still not parsed — see Status.
- **A modport belongs in the type name, glued.** `DataType::name` already
carries `pkg::state_t` glued, and every consumer prints or scans that one
string; `bus_if.mp` follows the same rule, so no consumer needed a new
field. The one place the two halves matter is `vlog_semantic`, which binds
the interface half (below).
- **A modport is not a symbol.** `ItemKind::Modport` is a leaf in
`vlog_semantic` (it declares nothing into a scope), so the modport half of
the type name is left unbound rather than recorded as a name that could
never resolve. The day modports become symbols, the tail is where to bind
them.
- **`module m (interface bus);`** — the *generic* interface port, whose type
is the `interface` keyword itself — is a separate production and still does
not parse. It is neither one of the three shapes filed nor reachable from
them; deliberately out of scope (Status).
## Handshakes
**Changed in `vlog_parser` (`crates/vlog_parser/src/parser.rs`):**
- `parse_port_list`'s ANSI/non-ANSI classification now also answers "ANSI" for
a leading `Ident` that begins a typed declarator (`at_typed_declarator`,
which already looks past a `pkg::` chain, a `#( ... )` override and packed
dimensions) or a modport-qualified port (`at_modport_port`). Every other
input classifies exactly as before — a macro token is `TokenKind::Directive`
and never `Ident`, and a name followed by `,`/`)` is still a non-ANSI list.
- `parse_ansi_port` takes `bus_if.mp` as the port's type via the new
`at_modport_port` / `parse_modport_port_type` pair.
- **No AST change.** The new shapes are ordinary `AnsiPort`s with
`dir: None` — the value a non-first direction-less port has always carried —
so `PortList`, `AnsiPort` and `DataType` are byte-identical to what
downstream already handles. `AnsiPort::ty.name` is the one field that can
now contain a `.`.
**Changed in `vlog_semantic` (`crates/vlog_semantic/src/bind.rs`):**
- `bind_data_type`'s unqualified arm binds the half of the type name before a
`.` (`bus_if` of `bus_if.mp`) as `Target::Type`, instead of using the glued
string as a name. The ANSI-port call site (`bind_module`, `bind.rs:393`) is
unchanged: the type window is still "start of the port → start of its name",
which is exactly right for a port that writes no direction.
**Changed in `lucisv_server` (`crates/lucisv_server/src/type_def.rs`):**
- `type_span` matches a site's type name by the half before its `.` as well as
by its last `::` segment, so the cursor on a modport-qualified port reaches
the interface. See that feature's work log.
**Consumed, unchanged:** `vlog_formatter` prints `AnsiPort` through
`ansi_port_cells`/`data_type`, which write `ty.name` verbatim — a glued
modport round-trips with no formatter change. `vlog_refactor`'s
`instantiate::ansi_ports` reads the port's *source text* between its start and
its name, so it reports `iface_bus.mst` as the type with no change either.
**Requested of other modules:** nothing.
## Status / TODO
- [x] Reproduce all three shapes as `Error` items before changing anything.
- [x] `parse_port_list`: classify a leading `ident ident` / `ident :: ident
ident` / `ident . ident ident` as ANSI.
- [x] `parse_ansi_port`: the modport-qualified interface port.
- [x] `bind_data_type`: bind the interface half of a dotted type name.
- [x] `type_def::type_span`: match it back.
- [x] 9 parser tests, 7 formatter table cases, 1 semantic binding test, 2
server tests, 2 refactor tests (one flipped, one new).
- [x] Corpus before/after: identical, with every file's formatted output
byte-identical (below).
- [x] Handshake 2 struck in `docs/features/type-definition/README.md`; the
stale annotation in `TODO.md` §9c corrected.
- [ ] **Not done, deliberately: `module m (interface bus);`** — the generic
interface port (IEEE 1800 §25.3), whose type is the `interface` keyword
itself. It is a different production, none of the three filed shapes
needs it, and it wants a `DataType` that can say "any interface", which
is a modelling question this round should not answer in passing.
- [ ] **Not done, deliberately: `virtual bus_if.mp v;`** — a modport-qualified
virtual interface in a *declaration* (§25.9). Reaching it means teaching
`parse_opt_data_type` about the dot, which changes how an identifier is
read in every position; it needs its own round and its own attack tests.
- [ ] **Not done, pre-existing: `module m (a[3], b);`** — a non-ANSI port with
a bit-select. It failed before this round and fails identically after
(pinned by `a_broken_header_still_reports_its_own_token`), and it is not
what this gap was about.
## Work log
### 2026-08-26 — dev agent
- **Reproduced first, and the filed report was accurate to the token.** A
throwaway `parse_source_tolerant` harness (removed after use) gave, for the
three shapes: `expected ")" (found "bus")`, `expected ")" (found ".")`,
`expected ")" (found "::")` — each producing two `Error` items, the header
and the orphaned `endmodule`. It also turned up two facts the report did not
state and the fix had to account for: `my_pkg::state_t s` already parsed in
a *non-first* position (`at_typed_declarator` walks `::` chains), while
`bus_if.mp bus` parsed in **no** position at all — so the modport is a
second, independent gap that merely looked like part of the first.
- **The disambiguation is a lookahead, not a new grammar.** `parse_port_list`
classified the list from its first token: a direction keyword, a type
keyword or a net keyword meant ANSI, anything else meant a non-ANSI name
list. The fix adds one clause — a leading `Ident` that `at_typed_declarator`
says still leaves an identifier for the declarator name. That predicate
already exists and is already the parser's answer to "type-then-name or
something else", including past `pkg::`, `#( ... )` and packed dimensions;
reusing it means the header list cannot drift out of step with how a body
declaration is read. The complement is exactly the non-ANSI list: after the
first name comes a `,` or a `)`, neither of which is an identifier.
- **The modport is glued into the type name, and only in a port header.**
`interface_port_header ::= interface_identifier [ . modport_identifier ]` is
a port production, not a data-type production, and after an identifier
anywhere else a `.` opens a member access — so `at_modport_port` /
`parse_modport_port_type` sit in `parse_ansi_port`, four tokens of lookahead
wide (`ident . ident ident`), and `parse_opt_data_type` is untouched. Gluing
follows the `pkg::state_t` precedent, which is what kept the AST, the
formatter and `vlog_refactor` out of this change entirely.
- **`vlog_semantic` binds the interface, not the glued string.** Left alone,
`bind_data_type` would have recorded a use of the name `bus_if.mp`, which
resolves nowhere and never could. It now takes the half before the dot. The
modport half is dropped rather than bound because this crate declares no
symbol for a modport (`ItemKind::Modport` is a leaf, `bind.rs:364`) — a
reference to a name nothing can declare is worse than no reference.
- **`type_def::type_span` needed the mirror of that.** The server matches a
declaration site's type name against the references the binder left in the
same window; with the site saying `bus_if.mp` and the reference saying
`bus_if`, the match failed and the jump answered nothing. One line: match by
the half before the `.` too, alongside the existing "last `::` segment"
rule.
- **No AST change, which was the point.** The brief asked whether `AnsiPort`
already models absence of direction — it does (`dir: Option<String>`), and
every continuation port (`input a, b`) has carried `dir: None` since the
beginning. So the new shapes produce AST that every existing consumer was
already written for, and the whole downstream cost of this round was two
match widenings (one in `vlog_semantic`, one in `lucisv_server`) that exist
only because of the modport dot.
- **Snapshot churn: none.** `crates/vlog_formatter/tests/snapshots/` is
untouched, and `git diff --stat` shows no fixture file changed. No
previously-refused fixture started formatting, so there was nothing to
justify.
- **Corpus: identical, which is itself the finding.** Baseline (HEAD 0e740d7,
the change stashed) and after: `813/820 (99.1%)`, 11 ok-unchanged, 802
would-reformat, 7 parse-error, 0 verification-error, 0 crash — and the two
TSVs are byte-identical, path for path, message for message. To prove the
stronger property the TSV does not carry, every corpus file was formatted to
stdout and hashed on both sides: all 820 hashes identical. So the passing
set is a (trivially strict) superset, no file's output moved by a byte, and
the safety net never fired. The reason nothing was gained is that this
corpus contains no direction-less first port at all — had it contained one,
that file would have been a `parse-error` row before and a formatted one
after; the 7 that remain are the known macro-bracketed covergroup, the
`` ` ``-number lex error and friends, unchanged. `vlog_semantic`'s corpus
acceptance run agrees from the other side: 860 files, 561 modules, 94685
references, 88.8% of external candidates answered — identical to three
decimal places before and after, so no previously-`Error` module header
joined the index either.
- **Tests.** `vlog_parser` +9 (`parser.rs` tests module): the three shapes,
each alone and mixed with directed ports in both orders; an `interface`
header taking the same list; a typed first port with packed dimensions and
a parameterized one; the non-ANSI list pinned by name *and* by comma flags,
plus the one-name list; `module m ();` and `module m;`; the `input a, b`
direction carry-over; a macro-produced list, an escaped name and a comment
before the comma, all three still non-ANSI because the clause fires only on
a `TokenKind::Ident`; and recovery on two genuinely broken headers plus a
never-closed one through `parse_source_tolerant`.
`vlog_formatter` +7 table cases in `tests/cases/module_headers.cases`
(each is an idempotency and equivalence assertion too — `format_source`
verifies both, and the harness re-formats the expected output).
`vlog_semantic` +1 (`tests/workspace.rs`):
`a_direction_less_first_ansi_port_binds_its_interface_type_cross_file`,
both spellings, cross-file through the unit table, plus an assertion that
the port declarations themselves survived.
`lucisv_server` +2 and one flipped (`type_def.rs`, now 47).
`vlog_refactor`: `an_interface_typed_port_list_is_refused_as_a_parse_failure`
→ `an_interface_typed_port_list_is_planned_like_any_other` (it asserted the
gap; it now asserts the plan, the rendered skeleton and that the skeleton
parses), and +1 rename test through a direction-less first port.
- **Gates.** `cargo fmt --all -- --check`: clean. `cargo clippy --all-targets
--workspace`: 0 warnings. `cargo test --workspace`: green (0 failed
anywhere; `vlog_parser` 214, `lucisv_server` 873). `cargo test -p
vlog_formatter`: green, all 8 targets, no snapshot churn.
`tools/corpus_check.sh` before and after: identical, exit 0 both times.
`cargo build && node editors/vscode/smoke.js target/debug/lucisv-server`:
`smoke: OK`. No `git commit`, no `git push`; `docs/site/` untouched.
## QA log
### 2026-08-26 — QA agent
**Gates, re-run independently — all matched the dev's claim exactly.**
`cargo fmt --all -- --check`: clean. `cargo clippy --all-targets --workspace`:
0 warnings. `cargo test --workspace`: green, `vlog_parser` 214 passed,
`lucisv_server` 873 passed / 4 ignored (the 4 ignored are pre-existing in
`lucisv_server::{hierarchy,includes,inlay}`, unrelated to this round).
`cargo test -p vlog_formatter --all-targets`: green, 7 test binaries run
(`lib`, `cases`, `deep_nesting`, `fences`, `fixtures`, `ranges`,
`verification`) — the work log's "all 8 targets" is one over the actual
binary count; cosmetic, not a gate failure. `cargo build && node
editors/vscode/smoke.js target/debug/lucisv-server`: `smoke: OK`.
**Corpus proof — reproduced independently, not taken on the dev's word.**
Built release binaries at the working tree and at a `git worktree add` of
`0e740d7` (the round's parent commit) so the working tree was never stashed.
`tools/corpus_check.sh corpus`: `813/820 (99.1%)` on both binaries, and the
two TSVs are byte-identical (`diff` exit 0) — this also matches the dev's own
`corpus-check-results.tsv` left in the tree byte-for-byte. Then, independent
of the TSV, every one of the 820 corpus files was formatted with `--stdout`
and SHA-256 hashed under both binaries: **all 820 hashes identical.** This is
the round's central safety claim and it now has two independent
confirmations (the dev's and this one), not one.
**A. Classification-boundary sweep** (`vlog_parser::parse_source_tolerant`,
current tree vs. the `0e740d7` worktree, diffed on `{diagnostics, debug AST}`):
| shape | verdict |
|---|---|
| `module m (a, b);` | unaffected, byte-identical AST (non-ANSI, untouched) |
| `module m (a);` | unaffected, byte-identical AST |
| `module m (mytype a);` | now ANSI, `ty.name="mytype"` — correct |
| `module m (a[3:0] b);` | now ANSI, packed dim consumed correctly |
| `module m (a #(8) b);` | now ANSI, `#(...)` consumed correctly |
| `module m (a.b);` (3-token, closes) | **unaffected** — `at_modport_port` needs a 4th `Ident` after the dotted name and correctly does not fire on `)`; still the same `expected ")" (found ".")` error both sides |
| `module m (a.b.c d);` (5-token) | **unaffected** — the lookahead is exactly 4 tokens wide (`ident . ident ident`), a longer dotted chain does not match `at_modport_port`, so this still errors identically both sides (an underdocumented but correctly-failing edge, not a misfire) |
| `module m (bus_if.mp bus, foo.bar baz);` (modport non-first) | now parses — confirms the work log's claim that `at_modport_port` fires per-port in `parse_ansi_port`, not just at list-classification, so any `ident.ident` port anywhere in an ANSI list now parses, not only `bus_if.mp` specifically |
| `module m (my_pkg::t.mp bus);` (`pkg::type` + modport dot) | **unaffected, fails safe** — neither `at_typed_declarator` nor `at_modport_port` fires (the `::`-chain walk stops before a bare `.`), so this still reports `expected ")" (found "::")` on both sides. Not filed, not tested by the dev, but does not misfire — worth a line in Assumptions if this shape is ever revisited |
| directive before first port, then a direction-less port (`` `ifdef FOO `endif bus_if bus, input logic clk); ``) | parses correctly — `take_list_directives` already peels the directive off before the ANSI/non-ANSI decision reads the next token, independent of this round's change |
**No misfire found in either direction**: nothing that used to be a non-ANSI
list started parsing as ANSI, and no shape swallowed characters it should not
have.
**B. Formatter round-trip.** All boundary and headline shapes above were run
through `format_source` (`vlog_formatter::format_source`); every one that
parses returned `Ok` (i.e. both `verify_equivalence` and `verify_convergence`
passed internally — the safety net never fired). The three headline shapes'
formatted output matches `module_headers.cases` byte-for-byte. `module m (a,
b); input a; output b; endmodule` and `module m (a); input a; endmodule`
(non-ANSI) format byte-identically between the `0e740d7` binary and the
working-tree binary. No real corpus file with an old-style bare-name port list
was found to spot-check against (consistent with the dev's note that this
corpus has no such file) — the in-memory comparison above is the substitute.
**C. `bind_data_type` / `type_span` modport handling — attacked, holds.**
Added one test, `renaming_the_modport_half_of_a_port_type_is_refused` in
`crates/vlog_refactor/tests/rename.rs` (kept; passes; +1 to `vlog_refactor`'s
rename suite, 52 total): a rename request positioned on the `mp` of `bus_if.mp
bus` is refused (`rename()` returns `Err`) rather than silently renaming the
interface or corrupting the modport spelling — confirming `ItemKind::Modport`
being an unbound leaf actually protects the rename path, not just the
go-to-type-definition path. Renaming `bus_if` itself through the same port
still renames correctly (already covered by the dev's
`an_interface_renames_through_a_direction_less_ansi_port`).
**D. Error recovery — two diagnostic-drift findings, not corruption.**
Severity: low. The claim "error recovery unchanged" holds for the two
specific fixtures the dev pinned (`module m (input, );` — confirmed
byte-identical diagnostics and AST both sides) but **does not hold** for one
of the exact shapes named in this round's own attack brief:
- `module m (foo bar` (never closes, no `endmodule`) — file:
`crates/vlog_parser/src/parser.rs`, the `ansi` lookahead added at the
`parse_port_list` classification site (~line 2415) plus `parse_ansi_port`
(~line 2494). Baseline: `expected ")" (found "bar")` at line 1 col 15.
Current: `expected ")" (found "<eof>")` at line 2 col 1. Cause: `foo bar` is
now recognized as a typed declarator (`at_typed_declarator` fires), so the
parser commits to consuming it as one `AnsiPort` and only then looks for the
next `,`/`)`, which is past EOF instead of at the second identifier.
- `module m (bus_if bus;` and `module m (bus_if bus\nendmodule\n)` — same
cause: baseline reports the error at the second identifier (`bus`, since it
reads `bus_if` alone as a non-ANSI name and then chokes on a second
identifier); current reports it at the token *after* the successfully
parsed `bus_if bus` port (`;` or `endmodule` respectively). The dev's own
test (`a_broken_header_still_reports_its_own_token`) only asserts
`!diags.is_empty()` for the never-closed case, not a specific position, so
this drift does not contradict any committed test — it contradicts the
QA-brief's framing of "same error positions/recovery as baseline", which is
not literally true for any genuinely-broken header that happens to start
with two adjacent identifiers.
- In every case checked, the file still ends up as a single `Error(RawText)`
item over the same span with the same raw text on both sides — no partial
output, no corruption, invariant #1 holds. This is a diagnostic-quality
regression at worst (arguably the new position is more precise, since it
points at the actual unexpected token rather than the first token past a
guessed name), not a safety issue. No fix applied; recorded for the lead's
judgment on whether the work log's phrasing needs softening.
**E. Fuzz-ish sweep.** 50 corpus files with an ANSI first port whose leading
direction keyword (`input`/`output`/`inout`) was stripped, re-parsed through
`parse_source_tolerant` under `catch_unwind`: **0 panics**. 23 re-parsed
clean (the stripped port had a real type after the keyword, e.g. `input logic
clk` → `logic clk`, and the new classification correctly reads it as a
direction-less typed port). 27 still report a parse error (the stripped port
was just `input a` → bare `a`, which correctly falls back to non-ANSI
classification and then fails on the *next* port's leading keyword with a
sensible `expected identifier (found "input")` — fails safe, not a crash, not
a silent misparse).
**F. The three left-open items.** `module m (a[3], b);` is pinned by
`a_broken_header_still_reports_its_own_token`, confirmed unchanged (matches
the dev's specific pinning claim — this is the only one of the three the dev
actually claimed a test for). `module m (interface bus);` (generic interface
port) and `virtual bus_if.mp v;` (modport-qualified virtual interface
declaration) are **not** pinned by any test anywhere in the diff, but both
were confirmed byte-identical (diagnostics + AST) between `0e740d7` and the
working tree by the same harness as section A. Recommendation, not a blocker:
a one-line regression test for each would close the gap between "verified
today" and "protected going forward," since neither has a test to catch a
future regression.
**G. CLAUDE.md compliance.** `crates/vlog_formatter/src/verify.rs`: `git diff
--stat` shows no change — invariant #4 correctly not triggered (no
normalization was widened, so no masked-corruption attack tests were owed).
`unwrap()`/`expect()`/`panic!`: the only three `panic!`s added are inside
`crates/vlog_parser/src/parser.rs`'s `#[cfg(test)] mod tests` (test-helper
`ansi_ports`/list-shape assertions) — permitted, not library-path code.
`at_modport_port` and `parse_modport_port_type` both have doc comments.
`docs/features/ansi-first-port/README.md` has each required section exactly
once, in the required order. The `type-definition` feature's Handshake 2 is
struck with `~~...~~` and a "Delivered 2026-08-26" annotation, matching this
repo's existing struck-handshake convention. `docs/site/` was not touched.
**Not independently verifiable:** the work log's `vlog_semantic` corpus
figure ("860 files, 561 modules, 94685 references, 88.8%... identical to
three decimal places before and after") has no corresponding script under
`tools/` and no committed test that reproduces it — unlike the
`vlog_formatter` corpus proof (section above), which was fully reproduced.
Not flagged as a defect (the two headline corpus proofs this round rests on
are independently confirmed), just noted as an unverifiable secondary claim.
**Fix made:** added
`renaming_the_modport_half_of_a_port_type_is_refused` to
`crates/vlog_refactor/tests/rename.rs` (section C above). No other changes to
the diff under review.
**Verdict: committable as-is.** No hard-invariant violation found (no
corruption, comments-preservation and idempotency untouched, `verify.rs`
untouched). One low-severity, non-blocking finding (D: diagnostic-position
drift on genuinely-broken headers, which the lead may want reflected in the
work log's phrasing) and two documentation/test-coverage gaps (the
unpinned left-open items in F, and the unreproducible semantic-corpus figure)
are recorded for follow-up, not for blocking this round.
## Review
## Review
### 2026-08-26 — lead
Reviewed the diff, the work log and the QA log; re-ran all gates myself,
clean. For the highest-invariant-risk crate in the repo, this round set
the standard: reproduction before any fix (which surfaced that the
modport shape was a second, independent gap), a classification clause
built on the parser's own existing lookahead rather than a new
recognizer, no AST change, and the corpus proof taken past the TSV to
all 820 formatted-output hashes — which QA then re-established
independently through a worktree build rather than trusting it. The
boundary AST-diff harness and the 50-file direction-stripping sweep are
exactly the adversarial coverage a parser change needs.
Rulings on QA's three notes. The diagnostic-position shift on broken
two-identifier headers is accepted: the parser committing further
before failing is inherent to recognizing the new legal prefix, no
Error item's span or text moved, and better commitment usually means
better messages. The two unpinned left-open items are now pinned — I
added `the_two_shapes_left_open_by_ansi_first_port_still_refuse` to the
parser suite so a future round changes them on purpose. The
unreproducible vlog_semantic corpus figure is a fair point filed
against that README's tooling, not this round; the workspace harness
tests remain the executable check. QA's modport-rename refusal test
closes the one write-path question the match-widenings raised.
Accepted as shipped.
+45 -9
View File
@@ -122,15 +122,22 @@ neither was done there:
the request above lands, that function is deleted and nothing else in this
module changes. *(It landed; the function is gone and nothing else in this
module changed.)*
2. **`vlog_parser`: an ANSI header whose *first* port carries no direction does
not parse.** `module m (bus_if bus, input logic clk);` becomes an `Error`
item, while `module m (input logic clk, bus_if bus);` parses fine — the
list is classified ANSI-or-not from its first element, and a bare
`type name` pair reads as neither a non-ANSI name list nor a directed port.
`module m (bus_if.mp bus)` (a modport-qualified port) and
`module m (my_pkg::state_t s)` do not parse either. Not this feature's to
fix, and not a regression it caused: the tests here write the interface
port second and say why.
2. ~~**`vlog_parser`: an ANSI header whose *first* port carries no direction
does not parse.**~~ **Delivered 2026-08-26 by `ansi-first-port`**
(`docs/features/ansi-first-port/README.md`): the port list is now
classified ANSI-or-not by what *follows* the first identifier, so all three
shapes parse into ordinary `AnsiPort`s with `dir: None`, and
`an_interface_port_reaches_its_interface` was flipped to write the
interface port first (with the second-port ordering kept as its own
assertion). Two tests were added here with it — a modport-qualified port
and a package-scoped first port. The original request read: `module m
(bus_if bus, input logic clk);` becomes an `Error` item, while `module m
(input logic clk, bus_if bus);` parses fine — the list is classified
ANSI-or-not from its first element, and a bare `type name` pair reads as
neither a non-ANSI name list nor a directed port. `module m (bus_if.mp
bus)` (a modport-qualified port) and `module m (my_pkg::state_t s)` do not
parse either. Not this feature's to fix, and not a regression it caused:
the tests here write the interface port second and say why.
## Status / TODO
@@ -159,6 +166,13 @@ neither was done there:
were renamed and one changed behavior (a `package` of the type's name is
now answered as `definition` answers it), each argued in that feature's
work log.
- [x] **Handshake 2 landed (2026-08-26, `ansi-first-port`):** the three header
shapes parse, so `an_interface_port_reaches_its_interface` writes the
interface port first (both orderings asserted), and two tests joined it —
`a_modport_qualified_port_reaches_its_interface` and
`a_package_scoped_first_port_reaches_its_typedef`. `type_span` matches a
type name by the half before its `.` as well as by its last `::`
segment, which is the one production line that changed. 47 tests.
- [x] One e2e round trip: the capability in the real handshake, a cross-file
package typedef, and a built-in answered with an empty array.
- [x] TODO.md §9c checkbox; `docs/features/lucisv-server/README.md` capability
@@ -357,6 +371,28 @@ neither was done there:
one-hop rule, the conventions — is unchanged. Full rationale, consumer audit
and corpus measurement: `docs/features/overlay-promotion/README.md`.
### 2026-08-26 — ansi-first-port dev agent (Handshake 2 landing)
- **The fixtures that wrote the port second are flipped.**
`an_interface_port_reaches_its_interface` now declares
`module m (bus_if bus, input logic clk);` — the spelling an interface port
is actually written in — and keeps the old ordering as a second module in
the same fixture, so the shape that used to be the only one that parsed is
still pinned. Two tests joined it:
`a_modport_qualified_port_reaches_its_interface` and
`a_package_scoped_first_port_reaches_its_typedef`.
- **One production line changed here, and it is a widening of a match, not of
an answer.** `type_span` already matched a site's type name by its last
`::` segment (a qualified type is two references and the second is the one
worth jumping to); it now also matches the half before a `.`, because
`vlog_parser` glues an interface port's modport onto the type name the same
way it glues a `pkg::` qualifier, and `bind_data_type` records the interface
half. Nothing else in this module moved: the answer is still
`nav::definition` of a name the binder itself recorded, so a wrong jump
would have to be a wrong *reference*, not a wrong match.
- Full rationale, the parser change and the corpus measurement:
`docs/features/ansi-first-port/README.md`.
## QA log
### 2026-08-26 — QA agent (continuation of an interrupted run)