Reject booleans in range and array bounds validation#225
Merged
Conversation
Copilot started work on behalf of
James Ball (james-ball-qualcomm)
March 19, 2026 21:41
View session
Co-authored-by: james-ball-qualcomm <140646808+james-ball-qualcomm@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [WIP] Addressing feedback on param type conversion in shared file
Reject booleans in range and array bounds validation
Mar 19, 2026
James Ball (james-ball-qualcomm)
approved these changes
Mar 19, 2026
Copilot started reviewing on behalf of
James Ball (james-ball-qualcomm)
March 19, 2026 21:50
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens validation in infer_param_type_string() to reject boolean values in range and array bounds, preventing Python’s bool-is-int behavior from silently producing incorrect rendered type strings.
Changes:
- Reject
True/Falseinrangebounds by adding explicitnot isinstance(..., bool)guards (and adjusting the error-path checks accordingly). - Reject
True/Falseinarraybounds with the same non-bool integer validation pattern. - Add regression tests covering boolean
lo/hifor bothrangeandarrayfatal paths.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tools/shared_utils.py | Harden range/array bounds validation to treat booleans as invalid integers and emit the existing “non-integer … value” fatal errors. |
| tests/shared_utils/test_shared_utils.py | Add fatal-case test coverage to ensure boolean bounds are rejected for both range and array validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: James Ball <jameball@qti.qualcomm.com>
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.
Python's
boolsubclassesint, soisinstance(True, int) is True. This causedrange: [0, true]andarray: [0, true]to silently pass validation and render as"range 0 to True"instead of being rejected.Changes
tools/shared_utils.py: Addnot isinstance(..., bool)guards to both range bounds and array bounds validators, consistent with the existingwidthcheck pattern:The error-path checks (
not isinstance(lo, int)) are updated tonot isinstance(lo, int) or isinstance(lo, bool)so booleans trigger the "non-integer value" fatal message.tests/shared_utils/test_shared_utils.py: Add four fatal-case tests coveringTrueasloandhiin bothrangeandarraybounds.📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.