Lower a monomorphic (new T args) over a user ADT without crashing codegen #53
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A monomorphic
(new Counter 42)over a user ADT that defines anewfunction passes
ail checkbut crashesail build:Reproducer:
examples/fieldtest/kem_2_counter_new.ail(the(new Counter 42)at line 31).
This is the same check-clean → build-crash class as
#51, but a differentroot.
#51was a polymorphicnewcarrying a written type-arg whoseresult-only forall var defaulted to
Unit. This is a monomorphicnew(no
NewArg::Type) over a user ADT: the desugar lowers it to(app Counter.new 42)— a type-scopedVar— and codegen does notrecognise
Counter.newas a static callee, so the name reaches theindirect-call path and surfaces as
UnknownVar.Claim (unverified): the gap is the
lower_app/is_static_calleelocksteppair documented in
CLAUDE.md(a name lowered by neither path falls throughto the indirect call). Not yet pinned to a line.
Pre-existing at HEAD: the failure reproduces with the
#51fix (ee4107c)stashed. The
#51fix deliberately left the monomorphic app-lowering pathunchanged, so it neither caused nor touches this. Surfaced while verifying
ee4107c.Acceptance:
(new Counter 42)over a user ADT with anewdef builds and runs