Skip to content

feat: support explicit numeric cast expressions#28

Merged
dodok8 merged 5 commits into
mainfrom
issue-15-explicit-numeric-casts
Jul 2, 2026
Merged

feat: support explicit numeric cast expressions#28
dodok8 merged 5 commits into
mainfrom
issue-15-explicit-numeric-casts

Conversation

@dodok8

@dodok8 dodok8 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add explicit numeric cast expressions for i64(expr) and f64(expr) and lower them through the existing staged query pipeline.

Closes #15

Scope

  • Documented numeric cast syntax and IR/SQLite planning contracts.
  • Added function-call parsing for IDENT(...) expressions.
  • Added Semantic IR CastExpr and resolver lowering for i64(expr) and f64(expr).
  • Added SQLite cast planning and SQL rendering using CAST(... AS INTEGER) and CAST(... AS REAL).
  • Added parser, resolver, SQLite plan/sqlgen, and query-pipeline coverage.

Spec and plan alignment

List the spec/ and plan/ files checked for this change. If the change intentionally diverges from them, explain why and include the required document update in this pull request.

  • spec/query.md
  • spec/ir.md
  • spec/sqlite-query-plan.md
  • plan/query-expression-model-plan.md

Tests

List the automated and manual checks performed.

  • cargo test --workspace
  • Other:

Review notes

Call out API boundaries, temporary rules, migration concerns, or follow-up work that reviewers should inspect closely.

  • Parser now accepts general function-call syntax, but resolver only accepts i64(expr) and f64(expr).
  • Unsupported function names and invalid numeric cast arity are rejected before IR construction.
  • String-to-number casts remain unsupported to avoid inheriting SQLite text coercion semantics.
  • SQLite cast lowering is structured in the plan; raw SQL fragments are not stored in IR or plan nodes.

AI assistance

Disclose AI tool usage according to AI_POLICY.md.

  • No AI tools were used.
  • AI tools were used and are disclosed here and in the relevant commit messages with Assisted-by trailers.

Tools and models:

  • Codex:gpt-5.5

dodok8 added 5 commits July 2, 2026 14:40
Define i64(expr) and f64(expr) as built-in numeric casts parsed through function-call syntax and resolved into cast-specific IR and SQLite plan nodes.

Assisted-by: Codex:gpt-5.5
Capture the AST and parser surface needed for built-in numeric cast syntax before implementing function-call parsing.

Assisted-by: Codex:gpt-5.5
Add an unresolved function-call AST node and parse IDENT(...) expressions while keeping resolver support closed until built-ins lower to semantic IR.

Assisted-by: Codex:gpt-5.5
Add cast value expressions to Semantic IR and lower i64(expr) and f64(expr) function calls in resolver value contexts while preserving unsupported function and arity diagnostics.

Assisted-by: Codex:gpt-5.5
Add SQLite plan, SQL generation, and query pipeline coverage for explicit numeric casts lowered from Semantic IR.

Assisted-by: Codex:gpt-5.5
@dodok8 dodok8 marked this pull request as ready for review July 2, 2026 06:03
@dodok8

dodok8 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@sonarqubecloud

sonarqubecloud Bot commented Jul 2, 2026

Copy link
Copy Markdown

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: be1955ec01

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dodok8 dodok8 merged commit d6c90ed into main Jul 2, 2026
2 checks passed
@dodok8 dodok8 deleted the issue-15-explicit-numeric-casts branch July 7, 2026 08:49
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.

feat: support explicit numeric cast expressions

1 participant