Finch/tests/new/fail
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nexoniarz 04eb0cce55 generics (in the compiler written in Finch)
fn max[T](T a, T b) -> T      struct Stack[T] { []T items }      fn Stack[T].push(T x)

The type is worked out from the arguments (max(3, 4), first([1, 2])) and written out
where it cannot be: max[float](1, 2.5), Stack[int](), Pair[str, int](...). Each use makes
its own copy, so a generic costs nothing at run time. Several parameters
(Pair[A, B]), nesting (Stack[Pair[int, str]]), methods, and printing (Stack[int](items: ...))
work. An error inside a generic says which version it was building.

boot.sh: 37 passed, 0 failed (stage 2 and 3 identical).
2026-10-25 20:53:13 +01:00
..
enum_bad_number.fch enums and match (in the compiler written in Finch) 2026-10-25 20:49:04 +01:00
enum_compare_order.fch enums and match (in the compiler written in Finch) 2026-10-25 20:49:04 +01:00
enum_no_variant.fch enums and match (in the compiler written in Finch) 2026-10-25 20:49:04 +01:00
generic_body_error.fch generics (in the compiler written in Finch) 2026-10-25 20:53:13 +01:00
generic_cant_infer.fch generics (in the compiler written in Finch) 2026-10-25 20:53:13 +01:00
generic_needs_type.fch generics (in the compiler written in Finch) 2026-10-25 20:53:13 +01:00
generic_not_generic.fch generics (in the compiler written in Finch) 2026-10-25 20:53:13 +01:00
generic_wrong_count.fch generics (in the compiler written in Finch) 2026-10-25 20:53:13 +01:00
match_arm_after_else.fch enums and match (in the compiler written in Finch) 2026-10-25 20:49:04 +01:00
match_arms_differ.fch enums and match (in the compiler written in Finch) 2026-10-25 20:49:04 +01:00
match_missing_variant.fch enums and match (in the compiler written in Finch) 2026-10-25 20:49:04 +01:00
match_needs_else.fch enums and match (in the compiler written in Finch) 2026-10-25 20:49:04 +01:00
match_not_a_variant.fch enums and match (in the compiler written in Finch) 2026-10-25 20:49:04 +01:00