Repository navigation
Truncate integer division in Python and JavaScript accessor and entry point bodies [patch] - #215
Merged
matt-edmondson merged 1 commit intoOct 14, 2026
Conversation
… point bodies [patch] #114 truncates integer / and % only inside a static-type scope, and only functions and methods opened one. Property accessor and entry point bodies had none, so the setter's value and any typed local there were not known to be integers and a / 2 still gave 3.5. Python and JavaScript now open a scope around each accessor body (the setter's value typed as the property, the getter returning it) and around the entry point body. Fixes #191 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ad87XvcvgZs8kt6MK9mwQE
|
matt-edmondson
deleted the
fix/191-accessor-entry-point-integer-division
branch
October 14, 2026 04:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #191
What was wrong
#114 truncates integer
/and%in Python and JavaScript only inside a static-type scope, and onlyGenerateFunctionDeclarationandGenerateMethodopened one. Property accessor bodies and entry point bodies had no scope, so the setter'svalueand any typed local there were not known to be integers.value / 2in a setter, ora / 2on anintlocal inmain, still gave3.5.Change
StandardLanguageGeneratorgets twoOpenStaticTypeScopeoverloads:valueas the property's type, and the getter's return type is the property's type.EntryPoint. It records typed locals and returnsintwhen the entry point returns an exit code.Tests
IntegerDivisionTests.Python_AccessorAndEntryPointBodies_MatchTheCFamilyandJavaScript_AccessorAndEntryPointBodies_MatchTheCFamilyrun the generated code underpython3andnode. Each covers a setter with negative and positive operands, a getter with a typed local, and an entry point with a typed local, for both/and%.setter(-7) recorded [-3.5, 1], expected [-3, -1]. With it, both pass.Coder.Testsuite: 1155 passed, 0 failed.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ad87XvcvgZs8kt6MK9mwQE
Generated by Claude Code