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:
1 parent
bbeb1de768
commit
b38b769932
7 files changed
+57
-15
No files matched your search
+4
-2
@@ -29,7 +29,7 @@ tests/
|
||||
│ ├── ast/ 160 × *.mq.md + sibling *.ast.json goldens
|
||||
│ └── semantics/ 73 × *.mq.md + sibling *.expected.json goldens
|
||||
├── negative/
|
||||
│ ├── *.mq.md 47 × compile-time hard-error fixtures + *.expected.json
|
||||
│ ├── *.mq.md 49 × compile-time hard-error fixtures + *.expected.json
|
||||
│ ├── warnings/ 2 × warning-model/control fixtures + *.expected.json
|
||||
│ └── runtime/ 21 × runtime-error fixtures + *.expected.json
|
||||
└── README.md this file
|
||||
@@ -79,7 +79,9 @@ The power/control-flow slice is pinned by:
|
||||
trailing colon, `end if`, empty `return`, multi-statement payload, bad
|
||||
`params` syntax); fixtures 24–29 and 46 pin control-stack pairing, including the
|
||||
heading boundary that reports `sem.unclosed_control` and `sem.unmatched_end`
|
||||
independently and `else` under an open `while`;
|
||||
independently, `else` under an open `while`, and a `params(...)` declaration
|
||||
that appears after code in an earlier heading segment or is duplicated across
|
||||
segments (48–49);
|
||||
* runtime negatives 11–12: negative integer exponent and exponent budget;
|
||||
* `crates/marqdo-frontend/src/payload.rs` span tests and
|
||||
`crates/cli/tests/integration_cli.rs` CLI span/E2E assertions.
|
||||
|
||||
@@ -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`
|
||||
Reference in new issue
Block a user