Skip to content

Conversation

@fglock
Copy link
Owner

@fglock fglock commented Oct 29, 2025

…nd integer shifts

Fixes t/op/bop.t from 68% to 89% passing (356→465 tests)

Major improvements:

  • Add binary&, binary|, binary^ operator support for 'use feature bitwise'
  • Fix reference stringification in bitwise operators (& | ^ ~)
    • Non-numeric values now properly stringify instead of numify
    • Uses ScalarUtils.looksLikeNumber() to detect numeric vs string ops
  • Implement proper shift operator semantics
    • Handle negative shifts (reverse direction)
    • Implement 32-bit UV semantics for unsigned shifts
    • Add integerShiftLeft/Right for 'use integer' pragma
    • Shifts >= 32 properly return 0 (or -1/0 for signed)
  • Detect 'use integer' pragma in EmitBinaryOperator for shifts

Files modified:

  • BitwiseOperators.java: Enhanced operators, added integer shift methods
  • EmitBinaryOperator.java: Added 'use integer' detection for shifts
  • EmitBinaryOperatorNode.java: Added binary& | ^ operator cases

Remaining edge cases (57/522 tests): tied variable magic, extreme shift values, and minor error message differences.

…nd integer shifts

Fixes t/op/bop.t from 68% to 89% passing (356→465 tests)

Major improvements:
- Add binary&, binary|, binary^ operator support for 'use feature bitwise'
- Fix reference stringification in bitwise operators (& | ^ ~)
  - Non-numeric values now properly stringify instead of numify
  - Uses ScalarUtils.looksLikeNumber() to detect numeric vs string ops
- Implement proper shift operator semantics
  - Handle negative shifts (reverse direction)
  - Implement 32-bit UV semantics for unsigned shifts
  - Add integerShiftLeft/Right for 'use integer' pragma
  - Shifts >= 32 properly return 0 (or -1/0 for signed)
- Detect 'use integer' pragma in EmitBinaryOperator for shifts

Files modified:
- BitwiseOperators.java: Enhanced operators, added integer shift methods
- EmitBinaryOperator.java: Added 'use integer' detection for shifts
- EmitBinaryOperatorNode.java: Added binary& | ^ operator cases

Remaining edge cases (57/522 tests): tied variable magic, extreme shift
values, and minor error message differences.
@fglock fglock merged commit a3d4f5e into master Oct 29, 2025
2 checks passed
@fglock fglock deleted the fix-bop-parser branch October 29, 2025 13:05
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.

2 participants