Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow number literals in SomeBV #245

Merged
merged 4 commits into from
Aug 10, 2024
Merged

Allow number literals in SomeBV #245

merged 4 commits into from
Aug 10, 2024

Conversation

lsrcz
Copy link
Owner

@lsrcz lsrcz commented Aug 10, 2024

This pull request allows number literals in SomeBV.

Previously, the following code would crash:

>>> 1 :: SomeIntN

This would require us to write the following code if we want to add 1 to some value:

>>> v = bv 4 5
>>> v + bv (finiteBitSize v) 1
0x6

This pull request allows us to directly use number literals in such scenarios:

>>> v + 1
0x6

We don't allow operations on literals, though, because the result may rely on the bit-widths.

>>> 1 * 1 :: SomeIntN
*** Exception: ...

Some operations allows on literals as the result does not rely on the bit-widths:

>>> 1 + 1 :: SomeIntN
2

Copy link

codecov bot commented Aug 10, 2024

Codecov Report

Attention: Patch coverage is 30.03534% with 198 lines in your changes missing coverage. Please review.

Project coverage is 54.12%. Comparing base (d1a6c6d) to head (f5bfe12).

Files Patch % Lines
src/Grisette/Internal/SymPrim/SomeBV.hs 30.03% 186 Missing and 12 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #245      +/-   ##
==========================================
- Coverage   54.53%   54.12%   -0.41%     
==========================================
  Files         117      117              
  Lines        9625     9816     +191     
  Branches      898      909      +11     
==========================================
+ Hits         5249     5313      +64     
- Misses       3478     3594     +116     
- Partials      898      909      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lsrcz lsrcz merged commit 2bdca9a into main Aug 10, 2024
18 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant