feat(server): add builtin function typechecking + BuiltinFn enum#149
Open
Khanathan wants to merge 4 commits into
Open
feat(server): add builtin function typechecking + BuiltinFn enum#149Khanathan wants to merge 4 commits into
Khanathan wants to merge 4 commits into
Conversation
…reusable typecheck primitives
…ser, normalizer, evaluator, added Expr::Cast variant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First step of RFC-001: Pythonic expressions. Converts
BuiltinFnfrom astatic struct table to a closed Rust enum, promotes
castto its ownExpr::CastAST node, and switchesExpr::Callto carry the resolvedBuiltinFninstead of aString. Adds shared type-inference primitives +helpers for later components. No IR or Python change.
Linked issues
Linked to #56
Implementation Plan
expr_builtins.rs→builtins/mod.rs; update 5 importers. Old built-in tests still passInferErrorandTypeClass.BuiltinFnenum (variants:IsNull,Quadkey—Castexcluded) + 5match selfmethods +Display+ name↔variant round-trip. Replaces old struct,BUILTINSslice, andlookup_builtinquadkey_infer(the one builtin without a shared helper). Project builds cleanlyExpr::Call.fn_name: String→Expr::Call.builtin: BuiltinFn; parser resolves names at parse time and emitsExprParseError::UnknownBuiltincasttoExpr::Cast { operand, target, span }; add arms inspan,referenced_fields,to_expr_string,eval_depth,infer_expr_type_innerVerification:
All three Rust gates passed:
Pre-flight checklist
bash .github/scripts/check.shexits 0 (or each step passes manually)