Fix rotate operator serialization (#655) - #656
Conversation
a708c65 to
4ac7d54
Compare
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (6)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe lexer recognizes additional 32-bit and 64-bit bitvector operators. The parser handles fake-binary rotation forms, the printer adjusts rotation formatting, and a regression test verifies print-and-reparse behavior. ChangesBitvector rotation parsing
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
test/regression/test_issue_655.ml (1)
3-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtend regression coverage beyond one successful i32 rotation.
The test only exercises
i32.rotrwith a successful parse. Add cases for the new i64/rotl forms and at least one malformed or non-literal rotation operand to verify the parser returns an error rather than raising.As per path instructions, tests must cover edge cases and error paths, not just happy paths.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/regression/test_issue_655.ml` around lines 3 - 22, Extend the regression test around expr, parse, and reparse to cover i64 rotate-left and rotate-right expressions in addition to the existing i32 case. Add at least one rotation using a non-literal or malformed operand, and assert that parsing returns Result.Error without raising; retain successful Result.Ok assertions for valid cases.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/smtml/parser.mly`:
- Around line 93-105: Update the FAKE_BINARY rotation branch in the parser to
consume the numeric NUM operand directly rather than parsing an arbitrary sexpr
and inspecting Expr.view. Construct Rotr or Rotl from that token value, and
avoid Fmt.failwith for malformed non-integer input so Expr.from_string retains
its result-based parser error path; use assertions only for impossible token
payloads.
In `@test/regression/test_issue_655.ml`:
- Line 1: Add the mandated three-line SPDX and copyright header at the top of
the new OCaml file, before the existing comment containing the i32 expression,
following the repository’s standard header format.
---
Nitpick comments:
In `@test/regression/test_issue_655.ml`:
- Around line 3-22: Extend the regression test around expr, parse, and reparse
to cover i64 rotate-left and rotate-right expressions in addition to the
existing i32 case. Add at least one rotation using a non-literal or malformed
operand, and assert that parsing returns Result.Error without raising; retain
successful Result.Ok assertions for valid cases.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: f0dadf0b-44de-4e06-ab50-1f074fac34c0
📒 Files selected for processing (5)
src/smtml/lexer.mllsrc/smtml/parser.mlysrc/smtml/ty.mltest/regression/dunetest/regression/test_issue_655.ml
4ac7d54 to
92f4473
Compare
1511d61 to
ea26463
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/regression/test_regression.ml`:
- Around line 1-5: Add a top-level OCaml module documentation comment using the
required `(** ... *)` syntax immediately after the license header and before the
`let ()` implementation in the module.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 6c1995a8-a7f2-4389-9a3a-e14bb0edd924
📒 Files selected for processing (6)
src/smtml/lexer.mllsrc/smtml/parser.mlysrc/smtml/ty.mltest/regression/dunetest/regression/test_issue_655.mltest/regression/test_regression.ml
🚧 Files skipped from review as they are similar to previous changes (4)
- src/smtml/ty.ml
- test/regression/test_issue_655.ml
- src/smtml/lexer.mll
- test/regression/dune
ea26463 to
8bce020
Compare
This issue was probably introduced by #629. Should have done a better job testing our parser at that point.
Closes #655