✓
Passing This code compiles and runs correctly.
Code
// ============================================================================
// Test 210_095: MUST_FAIL — a BARE literal argument must be REJECTED; a
// literal cannot be punned, so it REQUIRES an explicit label. Bare-side
// twin of 210_091's legal `echo(v: 5)`.
//
// `echo(5)` is none of the three legal forms (5 is not an Expr-typed first
// param, not explicitly named, and cannot pun). The legal spelling is
// `echo(v: 5)`.
//
// CURRENT BEHAVIOR (the bug this pins): compiles clean — a bare literal is
// bound positionally to parameter[0]. RED until the frontend rejects it.
// Diagnostic is a design call; expected_patterns below is the target.
// ============================================================================
~import std/io
~event echo { v: i32 }
| out i32
~echo => out v
~echo(5)
| out r |> std/io:print.ln("{{ r:d }}")
Must fail at frontend compile:
Parsing or type-checking must reject the program.
Error Verification
Actual Compiler Output
error[PARSE006]: bare argument '5' does not name a parameter of 'echo' — an explicit label is required
--> tests/regression/200_COMPILER_FEATURES/210_PARSER/210_095_reject_bare_literal_arg/input.kz:22:0
|
22 | ~echo(5)
| ^
hint: write it with an explicit label: 'v: 5'Flows
flow ~echo click a branch to expand · @labels scroll to their anchor
echo (5)
Test Configuration
MUST_FAIL