Skip to content

Reject negated Gin references instead of silently dropping the minus - #226

Draft
srijan2607 wants to merge 1 commit into
google:masterfrom
srijan2607:fix/reject-negated-references
Draft

srijan2607 wants to merge 1 commit into
google:masterfrom
srijan2607:fix/reject-negated-references

Conversation

@srijan2607

Copy link
Copy Markdown

Gin currently accepts -%amount and -@amount() but silently drops the minus. For example, binding capture.value = -%positive when positive = 7 injects 7.

Raise SyntaxError when a consumed minus is not followed by a literal token, rather than falling through to reference parsing. This rejects unsupported negation; it does not add expression evaluation. Negative numeric literals keep working.

Tests cover macros and configurable references, whitespace, nested containers, and negative numeric literals. All 13 parser tests pass on Python 3.11 and 3.13. The broader native core runs have the same two missing-fixture-module errors on base and patch; the optional TensorFlow/PyTorch installation-based test matrix was not run.

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