Koja 0.20.1

Released November 6, 2026 · All releases · GitHub release

Added

  • A fn typed field can default to a named function reference, as in on_reject: fn (Int) -> () = &ignore_reject/1. A constant still does not hold one.

Changed

  • A public struct or enum variant whose field default names a priv constant or priv fn is a compile error, the same as a public field whose type is priv. Before, a public struct’s default could read a priv constant.

Fixed

  • A Map or Set keyed by a union, by an enum with its own Hash impl, or by a generic struct whose Hash and Equality impls are conditional compiles under --backend=llvm. Before, each one typechecked and ran under the interpreter but failed LLVM codegen with “does not implement Hash”.
  • == and != accept a static method call or a qualified constant as the right operand, so p == Point.ORIGIN and i == Outer.Inner.make(1) typecheck, as does Option.Some(i) == Option.Some(Outer.Inner.make(1)). Before, the right operand was resolved twice and the second pass read the path as an unknown identifier or as a static call on a value. An operand of == that fails to typecheck now reports once.
  • A type parameter that appears only in a protocol bound’s arguments is inferred from the bounded type’s conformance. fn drain<R: IO.Reader<E>, E>(source: R) called with an IO.Descriptor fills E with IO.Error, and fn count<T, Cursor, E: Enumeration<T, Cursor>>(source: E) called with a List<Int> fills T and Cursor. Before, both failed with “cannot infer type parameter”, and a generic consumer of IO.Reader<E> had to name one error type in its bound. When no conformance answers, the call reports the empty parameter once. Before, a second error named the bound with <unresolved> in it.
  • assert types a comparison in either direction, so assert Option.None == p and assert 0 == n on a UInt32 typecheck the way assert p == Option.None and assert n == 0 do. Before, only the right operand took its type from the left. An operand that fails to typecheck now reports once. Before, the failure was followed by four more errors that named the internal $assert_left_0 temporary.
  • A Map or Set keyed by a type alias to a union, such as type Key = Int | String and Map<Key, Int>, accepts a member of the union as a key, so table.get(7) and table.put("seven", 7) typecheck. Before, both failed with “type parameter K of Map cannot be both Key and Int”.
  • A protocol default method that collides with a function the type already defines reports already defined at the impl block or header entry, with a note at the previous definition. Before, the method was dropped silently and the first call reported an unrelated error.
  • An operator stays quiet when an operand already failed to typecheck. Before, not nope and nope + 1 reported the unknown identifier and then a second error about an <unresolved> operand.
  • A string interpolation whose expression fails to typecheck reports once. Before, "#{nope}" reported the unknown identifier twice, because the resolver wrapped the failed expression in .format() and walked it again.