Skip to content

feat(server): add builtin function typechecking + BuiltinFn enum#149

Open
Khanathan wants to merge 4 commits into
beava-dev:mainfrom
Khanathan:feat/issue-56-builtin-typechecking
Open

feat(server): add builtin function typechecking + BuiltinFn enum#149
Khanathan wants to merge 4 commits into
beava-dev:mainfrom
Khanathan:feat/issue-56-builtin-typechecking

Conversation

@Khanathan
Copy link
Copy Markdown

@Khanathan Khanathan commented May 21, 2026

Summary

First step of RFC-001: Pythonic expressions. Converts BuiltinFn from a
static struct table to a closed Rust enum, promotes cast to its own
Expr::Cast AST node, and switches Expr::Call to carry the resolved
BuiltinFn instead of a String. Adds shared type-inference primitives +
helpers for later components. No IR or Python change.

Linked issues

Linked to #56

Implementation Plan

  • Add tests for all components that will be implemented in this PR
  • Move expr_builtins.rsbuiltins/mod.rs; update 5 importers. Old built-in tests still pass
  • Add InferError and TypeClass.
  • Add 4 reusable typechecking primitives + 8 shared helpers. All tests for those pass
  • BuiltinFn enum (variants: IsNull, QuadkeyCast excluded) + 5 match self methods + Display + name↔variant round-trip. Replaces old struct, BUILTINS slice, and lookup_builtin
  • quadkey_infer (the one builtin without a shared helper). Project builds cleanly
  • Refactor Expr::Call.fn_name: StringExpr::Call.builtin: BuiltinFn; parser resolves names at parse time and emits ExprParseError::UnknownBuiltin
  • Promote cast to Expr::Cast { operand, target, span }; add arms in span, referenced_fields, to_expr_string, eval_depth, infer_expr_type_inner
  • Runs all tests and style checks. Everything passes, no warnings

Verification:

All three Rust gates passed:

  • fmt: 25s
  • clippy: 324s
  • test: 587s

Pre-flight checklist

  • bash .github/scripts/check.sh exits 0 (or each step passes manually)
  • Verification block above replaced with real output

@Khanathan Khanathan marked this pull request as ready for review May 21, 2026 01:02
@Khanathan Khanathan requested a review from petrpan26 as a code owner May 21, 2026 01:02
@Khanathan Khanathan changed the title feat(server): add builtin function typechecking feat(server): add builtin function typechecking + BuiltinFn enum May 23, 2026
…ser, normalizer, evaluator, added Expr::Cast variant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant