diff --git a/.changeset/cypher-math-arithmetic-inference.md b/.changeset/cypher-math-arithmetic-inference.md deleted file mode 100644 index 36e6d6f..0000000 --- a/.changeset/cypher-math-arithmetic-inference.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -"@evryg/effect-cypher-codegen": patch ---- - -Improve numeric type inference in the Cypher type checker. - -- Recognize Neo4j scalar math functions. `log`, `log10`, `exp`, `sqrt`, the trigonometric - functions, `ceil`, `floor`, `round`, `e()`, `pi()`, `rand()` and friends now infer `Double`; - `sign` infers `Long`; and `abs` preserves its argument's numeric type. Previously any of these - threw `Unrecognized function`, failing codegen for queries that projected a bare math call such as - `RETURN log(x) AS weight`. -- Unify numeric operand types in arithmetic. Expressions previously took only the first operand's - type, so `Long * Double` (or `priceLong * 1.5`) inferred `Long` — emitting `Neo4jInt` and risking - a runtime decode failure on floats. Numeric arithmetic now unifies operands by the numeric join - (`Long ⊔ Double = Double`), a `Double` anywhere widens the result, and exponentiation (`^`) yields - `Double`. Numeric literals also carry their int/float distinction (`1.5`/`1e3` → `Double`). String - and list concatenation are unaffected. diff --git a/packages/cypher-codegen/CHANGELOG.md b/packages/cypher-codegen/CHANGELOG.md index 1d962b7..be7ad37 100644 --- a/packages/cypher-codegen/CHANGELOG.md +++ b/packages/cypher-codegen/CHANGELOG.md @@ -1,5 +1,22 @@ # @evryg/effect-cypher-codegen +## 0.4.3 + +### Patch Changes + +- [#95](https://github.com/evryg-org/effect-contrib/pull/95) [`2c84a48`](https://github.com/evryg-org/effect-contrib/commit/2c84a48c79ea89463ec9ecf621a7e30c01e6d9ca) Thanks @jbmusso! - Improve numeric type inference in the Cypher type checker. + - Recognize Neo4j scalar math functions. `log`, `log10`, `exp`, `sqrt`, the trigonometric + functions, `ceil`, `floor`, `round`, `e()`, `pi()`, `rand()` and friends now infer `Double`; + `sign` infers `Long`; and `abs` preserves its argument's numeric type. Previously any of these + threw `Unrecognized function`, failing codegen for queries that projected a bare math call such as + `RETURN log(x) AS weight`. + - Unify numeric operand types in arithmetic. Expressions previously took only the first operand's + type, so `Long * Double` (or `priceLong * 1.5`) inferred `Long` — emitting `Neo4jInt` and risking + a runtime decode failure on floats. Numeric arithmetic now unifies operands by the numeric join + (`Long ⊔ Double = Double`), a `Double` anywhere widens the result, and exponentiation (`^`) yields + `Double`. Numeric literals also carry their int/float distinction (`1.5`/`1e3` → `Double`). String + and list concatenation are unaffected. + ## 0.4.2 ### Patch Changes diff --git a/packages/cypher-codegen/package.json b/packages/cypher-codegen/package.json index 2e19a37..18d8d7b 100644 --- a/packages/cypher-codegen/package.json +++ b/packages/cypher-codegen/package.json @@ -1,6 +1,6 @@ { "name": "@evryg/effect-cypher-codegen", - "version": "0.4.2", + "version": "0.4.3", "type": "module", "license": "MIT", "description": "Cypher type checker and code generator: parses .cypher files, infers types, and generates typed Effect modules",