Skip to content

v0.0.17: Generics monomorphization (C6i)

Choose a tag to compare

@aallan aallan released this 25 Feb 01:47
9d5d265

C6i: Generics Monomorphization

Compile forall<T> functions to WASM via monomorphization.

Added

  • Collection pass: walk non-generic bodies to find calls to generic functions, infer type bindings
  • AST substitution: create monomorphized FnDecl copies with type variables replaced
  • Name mangling: identity + (Int,) becomes identity$Int
  • Call rewriting: generic calls resolve to mangled names at WASM translation time
  • FnCall type inference for if-branches and chained calls
  • 17 new codegen tests (660 total)

Closes #29 · PR: #42