✓
Passing Passing: the compiler rejects this program as expected.
Code
// PINS: a proto field list takes each name once. A `std/types:proto` block
// binding `rpm` on two lines is a declaration fault the door refuses — the
// derived container would otherwise emit the name twice into one struct.
import std/io
import std/types
import std/list
std/types:proto(Dup) {
rpm: i32
rpm: i32
}
std/list:new(Dup)
| list xs |> std/io:print.ln("made")
| err e |> std/io:print.ln("ERR {{ e:s }}")
Actual compiler output
error[KORU173]: std/types/proto(Dup): field 'rpm' is bound twice — a proto entry takes each field name once
--> tests/regression/600_STDLIB/665_PROTO/665_015_proto_field_bound_twice/input.k:8:0Compiler must reject:
Compilation must fail with a diagnostic.
Flows
flow ~proto click a branch to expand · @labels scroll to their anchor
proto (expr: Dup, source: rpm: i32
rpm: i32)
flow ~new click a branch to expand · @labels scroll to their anchor
new (Dup)
Test Configuration
MUST_ERROR