mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #11052 from blishko/issue-10986
[SMTChecker] Correct handling of FixedBytes constants initialized with string literal
This commit is contained in:
commit
d42d0faf41
@ -7,8 +7,8 @@ Compiler Features:
|
|||||||
|
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
* SMTChecker: Fix internal error on ``FixedBytes`` constant initialized with string literal.
|
||||||
* SMTChecker: Fix internal error on pushing to ``string`` casted to ``bytes``.
|
* SMTChecker: Fix internal error on pushing to ``string`` casted to ``bytes``.
|
||||||
|
|
||||||
AST Changes:
|
AST Changes:
|
||||||
|
|
||||||
|
|
||||||
|
@ -260,6 +260,7 @@ public:
|
|||||||
}
|
}
|
||||||
friend Expression operator==(Expression _a, Expression _b)
|
friend Expression operator==(Expression _a, Expression _b)
|
||||||
{
|
{
|
||||||
|
smtAssert(_a.sort->kind == _b.sort->kind, "Trying to create an 'equal' expression with different sorts");
|
||||||
return Expression("=", std::move(_a), std::move(_b), Kind::Bool);
|
return Expression("=", std::move(_a), std::move(_b), Kind::Bool);
|
||||||
}
|
}
|
||||||
friend Expression operator!=(Expression _a, Expression _b)
|
friend Expression operator!=(Expression _a, Expression _b)
|
||||||
|
@ -940,7 +940,7 @@ void SMTEncoder::endVisit(Identifier const& _identifier)
|
|||||||
{
|
{
|
||||||
solAssert(decl->value(), "");
|
solAssert(decl->value(), "");
|
||||||
decl->value()->accept(*this);
|
decl->value()->accept(*this);
|
||||||
defineExpr(_identifier, expr(*decl->value()));
|
defineExpr(_identifier, expr(*decl->value(), _identifier.annotation().type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
pragma experimental SMTChecker;
|
||||||
|
|
||||||
|
contract MockContract {
|
||||||
|
bytes4 public constant SENTINEL_ANY_MOCKS = hex"01";
|
||||||
|
mapping(bytes4 => bytes4) methodIdMocks;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
methodIdMocks[SENTINEL_ANY_MOCKS] = 0;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
pragma experimental SMTChecker;
|
||||||
|
|
||||||
|
contract MockContract {
|
||||||
|
bytes4 public constant SENTINEL_ANY_MOCKS = hex"01";
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
assert(SENTINEL_ANY_MOCKS >= 0);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user