Summary
PR #659's template-warning suppression pass in vera/codegen/core.py::compile_program keys compiled_mono_bases on bare base function names. If two modules in the same compile unit declare a forall<T> function with the same name, the suppression set conflates them — if either compiles, BOTH templates' warnings get suppressed.
Reproducer (hypothetical)
-- prelude:
private forall<T> fn map(@Option<T>, ...) -> ...
-- user module:
public forall<T> fn map(@Array<T>, ...) -> ...
If only one of these has working mono clones in the user's program, the other's template warning gets suppressed too (because compiled_mono_bases contains "map" without module disambiguation).
Current mitigations
- Today's user-vs-prelude namespace separation: users can't redeclare prelude names like
option_map, etc. But user-defined module imports CAN share names.
- The failure mode is "warning suppressed when it shouldn't be" — not a runtime bug. The actual functions still compile correctly; users just lose the per-function diagnostic.
Source location
vera/codegen/core.py around lines 500-580. The relevant code:
compiled_mono_bases: set[str] = set()
for mdecl in mono_decls:
orig_name = mdecl.name.split("$")[0]
# ... compile ...
if fn_wat is not None:
compiled_mono_bases.add(orig_name)
orig_name is the bare base name ("map" from "map$Int"). No module qualification.
Suggested fix
Key on (module, name) rather than just name. Requires tracking module attribution through Pass 1.5's mono-decl synthesis. Alternatively, scope the suppression to the current program's forall_decl_names set only (which excludes imported module declarations).
Investigation context
Surfaced as F4 in the multi-agent review of PR #659. Not blocking for #659 — the failure mode is benign (silenced warning) and only reachable when users intentionally shadow names across modules.
Acceptance criteria
References
Summary
PR #659's template-warning suppression pass in
vera/codegen/core.py::compile_programkeyscompiled_mono_baseson bare base function names. If two modules in the same compile unit declare aforall<T>function with the same name, the suppression set conflates them — if either compiles, BOTH templates' warnings get suppressed.Reproducer (hypothetical)
If only one of these has working mono clones in the user's program, the other's template warning gets suppressed too (because
compiled_mono_basescontains"map"without module disambiguation).Current mitigations
option_map, etc. But user-defined module imports CAN share names.Source location
vera/codegen/core.pyaround lines 500-580. The relevant code:orig_nameis the bare base name ("map"from"map$Int"). No module qualification.Suggested fix
Key on
(module, name)rather than justname. Requires tracking module attribution through Pass 1.5's mono-decl synthesis. Alternatively, scope the suppression to the current program'sforall_decl_namesset only (which excludes imported module declarations).Investigation context
Surfaced as F4 in the multi-agent review of PR #659. Not blocking for #659 — the failure mode is benign (silenced warning) and only reachable when users intentionally shadow names across modules.
Acceptance criteria
forall<T> fn shared_name) compiles correctly, and BOTH templates emit warnings if their mono clones don't compiletests/test_codegen.py::TestGenericMonoSuffixFromSlotRef604still passReferences
compiled_mono_bases#604investigation comment — the original "suppress when at least one mono compiles" idea