fix(frontend): enforce function-wide params position

The concurrent mapper tracked the first params declaration in the Mapper (so
duplicates across heading segments were caught) but checked 'first payload'
with a per-segment vector index. A params(...) in a later ### @exec segment
was therefore accepted even after an earlier segment had executed statements,
and a duplicate could even be reported as a position error.

- track whether any statement has been lowered for the function and require
  params(...) to come before it, across all heading segments
- check duplicates first, then execution order, then the in-segment index
- add negative fixtures 48 (after an earlier segment) and 49 (duplicate
  across segments); update the corpus count and spec wording

Verified: cargo test --workspace --locked green (62 targets).
This commit is contained in:
cflmy committed 2026-11-21 15:36:30 +08:00
1 parent bbeb1de768
commit b38b769932
7 files changed
+57 -15

No files matched your search

@@ -0,0 +1,5 @@
{
"codes": [
"sem.signature_position"
]
}
@@ -0,0 +1,9 @@
## @exec f
`x = 1`
### @exec 续写
`params(y: Int)`
`return x`
@@ -0,0 +1,5 @@
{
"codes": [
"sem.signature_position"
]
}
@@ -0,0 +1,9 @@
## @exec f
`params(x: Int)`
### @exec 续写
`params(y: Int)`
`return x`