Skip to content

Handle defined numeric and string types in float() - #1036

Open
Twiink wants to merge 1 commit into
expr-lang:masterfrom
Twiink:fix/float-defined-values-20261127-r4
Open

Twiink wants to merge 1 commit into
expr-lang:masterfrom
Twiink:fix/float-defined-values-20261127-r4

Conversation

@Twiink

@Twiink Twiink commented Nov 27, 2026

Copy link
Copy Markdown

The checker accepts float(value) based on the field's reflect.Kind, but the runtime only recognizes exact built-in types. A field declared as type Rate float32 compiles and then fails with an invalid operation during evaluation. The same mismatch applies to defined integer and string types.

Keep the existing paths for built-in types and read the underlying kind for the supported defined types. Text still goes through the existing numeric parser. This addresses the float conversion noted in the discussion on #632.

Added compile-and-run regressions for a named float, signed and unsigned integers, and a decimal string. Ran the full race-enabled test suite, the expr_debug debugger tests, and go vet ./....

This branch has not been deployed

No deployments
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