?
Unknown Status unknown.
Code
// TEST: MUST_FAIL - Instantiated generics with different params are distinct
//
// Option<i32> and Option<f32> are different types.
// Koru should reject passing one where the other is expected.
//
// Expected: Compilation error - type mismatch
~import "$std/types"
~struct(Option<T>) { some: T, none }
~type(OptionalInt = Option<i32>)
~type(OptionalFloat = Option<f32>)
~event process_int { val: OptionalInt }
~proc process_int|zig {
}
~event main {}
~proc main|zig {
// ERROR: Passing OptionalFloat where OptionalInt is expected
const f = OptionalFloat{ .some = 3.14 };
~process_int(val: f)
}
~main()
Must contain:
type mismatchError Verification
Expected Error Pattern
MUST_FAILActual Compiler Output
error[KORU003]: inline flows are not supported inside `~proc` bodies: ~process_int(val: f)
--> tests/regression/000_CORE_LANGUAGE/030_TYPES_VALUES/030_132_generic_type_mismatch/input.kz:24:5
|
24 | ~process_int(val: f)
| ^
hint: lift this into a top-level subflow (e.g. `~my_event = call(args) | branch x |> done {}`) or invoke the event from outside the proc bodyTest Configuration
MUST_FAIL