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
SMTChecker: Relax assertions regarding sort compatibility when creating expressions #14980
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I think maybe we could improve test coverage?
mapping(int => int) v1; | ||
mapping(int => uint) v2; | ||
mapping(uint => int) v3; | ||
mapping(uint => uint) v4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about mixing other types like mapping(bytes14 => int)
and mapping(uint => bytes14)
?
Also, I was looking at #14840 and noticed that in that in
mapping(bool => int240) internal v1; |
v1
is declared and not used. Although this is already merged I was wondering about that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to suggest a more meaningful name to this test too.
Maybe mapping_integer_signedness_compatibility/deletion
... I just think we should not continue the trend of just numbering these tests which contain mappings :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still regarding the tests, could we also add tests involving arrays, i.e, int[] x
, uint[10] y
or does that makes no sense here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I was looking at #14840 and noticed that in that in
mapping(bool => int240) internal v1;
v1
is declared and not used. Although this is already merged I was wondering about that.
The example in #14791 was crashing with this kind of mapping just being declared, but not used. So I kept it in the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will rename the test, I agree that it should named properly.
What about mixing other types like mapping(bytes14 => int) and mapping(uint => bytes14)?
I can add more of these mappings, did not think of bytes
. The problem was in the type of the domain vs the type of the index. I believe the type of the range should not actually matter.
Still regarding the tests, could we also add tests involving arrays, i.e, int[] x, uint[10] y or does that makes no sense here?
You mean declaring such arrays and then trying to access/delete some element?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add more of these mappings, did not think of
bytes
. The problem was in the type of the domain vs the type of the index. I believe the type of the range should not actually matter.
Ok.
You mean declaring such arrays and then trying to access/delete some element?
Yes, but I am not sure if that makes sense in the context of the problem here.
The helper method makes clear the intent clear and should be more readable than if-then-else branches with smtAssertions. Moreover, some of the if-conditions were not checking the right thing.
5f45cb8
to
7afc8f0
Compare
7afc8f0
to
255a630
Compare
@matheusaaguiar , I renamed the test, added a mapping with Do you think we can merge this? |
255a630
to
0c831e0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved.
We could squash commits, but that's more aesthetics than a requirement.
This finishes the work started by #14180, which relaxed most of the assertions related to checking compatibility of sorts to allow mixing signed and unsigned
Int
sorts.This PR has two parts:
Fixes #14792.