✓
Passing Passing: the compiler rejects this program as expected.
Code
// An explicit `label: value` names a parameter. A callee that declares an
// implicit slot (`if { expr: Expression }`) does not make up for a label that
// names nothing — `cond` is not a parameter of `if`, and saying so is the
// frontend's job.
//
// The bare form `if(true)` is the canonical spelling and the implicit slot
// absorbs it (219 call sites across the suite). What this pins is the other
// side: the slot excuses BARE arguments, never a wrong label.
import std/io
if(cond: true)
| then |> std/io:print.ln("then branch")
| else |> std/io:print.ln("else branch")
Actual compiler output
error[PARSE006]: unknown parameter 'cond' — 'if' has no parameter named 'cond'
--> tests/regression/200_COMPILER_FEATURES/210_PARSER/210_165_reject_unknown_label_on_implicit_slot_callee/input.k:11:0
|
11 | if(cond: true)
| ^
hint: remove the argument, or label it with a real parameter (e.g. 'expr:')Must fail at frontend compile:
Parsing or type-checking must reject the program.
Error output must contain
'if' has no parameter named 'cond'Flows
flow ~if click a branch to expand · @labels scroll to their anchor
if (cond: true)
Test Configuration
MUST_ERROR