✓
Passing Passing: the compiler rejects this program as expected.
Code
// ============================================================================
// Test 210_095: MUST_ERROR — 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
tor echo { v: i32 } -> i32
echo -> v
echo(5): r |> std/io:print.ln("{{ r:d }}")
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.k:21:0
|
21 | echo(5): r |> std/io:print.ln("{{ r:d }}")
| ^
hint: write it with an explicit label: 'v: 5'Must fail at frontend compile:
Parsing or type-checking must reject the program.
Expected patterns
Each line is a regex that must match the compiler error output.
error\[
explicit labelFlows
flow ~echo click a branch to expand · @labels scroll to their anchor
echo (5)
Test Configuration
MUST_ERROR