blaise/docs
Graeme Geldenhuys 703e44dfa1 feat(semantic): accept set literals as 'set of' arguments
A bracket literal can now be passed directly where a `set of <enum>`
parameter is expected, e.g. Configure([optA, optC]) or Report([]) — no
named intermediate variable needed.

Previously such a call failed overload resolution: a bare [a, b] is
analysed (lacking set context) as an open-array of the enum, which does
not match the set parameter. Now:

- ArgMatchScore matches a TArrayLiteralExpr argument against a set
  parameter — non-empty when the members share the param's base enum,
  and the empty [] against any set — checked before the nil-arg bail so
  [] (which has no resolved type) is handled.
- AnalyseArrayLiteralExpr defers an empty [] to a nil type instead of
  erroring outright; it is only meaningful with a set target.
- After overload resolution, RetypeSetLiteralArgs re-points each matched
  set-literal argument's ResolvedType at the parameter's set type, so
  codegen emits the bitmask (EmitArrayLiteralExpr dispatches on tySet).
- CheckTypesMatch gained a nil-actual guard (a clean "no value type"
  error instead of a segfault on a stray []), and the assignment path
  rejects an empty [] assigned to a non-set LHS.

Fixes a second, latent bug exposed by passing sets by value: a `set of`
value parameter of <=32 members (QBE type w) was spilled in the prologue
with storel, which QBE rejects. Added a tySet case to both param-spill
sites (storew for w sets, storel for l sets).

Tests: 6 IR/semantic cases in cp.test.sets (arg OK / empty / wrong-enum
/ empty-non-set-assign fail, bitmask fold, w-width param spill) and an
e2e in cp.test.e2e.misc. language-rationale updated. Full suite 2335
tests pass; fixpoint clean.
2026-06-02 20:04:17 +01:00
..
benchmark.txt docs(benchmark): add QBE 1.3 measurement entry 2026-06-02 17:17:54 +01:00
design.adoc fix(semantic): type-check indirect-call arguments; doc record-param ABI 2026-05-05 00:42:11 +01:00
future-improvements.adoc docs: rewrite 'Function calls requiring ()' section as proper design entry 2026-06-02 09:54:14 +01:00
grammar.ebnf feat(const): set-valued constants (const X = [a, b]) 2026-06-02 19:48:27 +01:00
language-rationale.adoc feat(semantic): accept set literals as 'set of' arguments 2026-06-02 20:04:17 +01:00
testing-strategy.adoc docs: add testing strategy document 2026-05-16 00:38:58 +01:00