Skip to content

Conversation

@thevilledev
Copy link
Contributor

Update AsBool implementation to strictly return a boolean value, ensuring that undefined variables are cast to false. Undefined variables resolve to nil when AllowUndefinedVariables is enabled. This adds a new ToBool runtime helper, updates the OpCast VM instruction to support boolean casting, and modifies the compiler to emit this cast when AsBool is used. Adds regression tests.

Fixes #830

Update AsBool implementation to strictly return a boolean value,
ensuring that undefined variables are cast to false. Undefined
variables resolve to nil when AllowUndefinedVariables is enabled.
This adds a new ToBool runtime helper, updates the OpCast VM
instruction to support boolean casting, and modifies the compiler
to emit this cast when AsBool is used. Adds regression tests.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
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.

expr.AsBool() not working in this case

1 participant