mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Remove Type from SolverInterface
This commit is contained in:
parent
45eba27424
commit
7a91c9b971
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include <libsmtutil/Sorts.h>
|
#include <libsmtutil/Sorts.h>
|
||||||
|
|
||||||
#include <libsolidity/ast/Types.h>
|
|
||||||
#include <liblangutil/Exceptions.h>
|
#include <liblangutil/Exceptions.h>
|
||||||
#include <libsolutil/Common.h>
|
#include <libsolutil/Common.h>
|
||||||
#include <libsolutil/Exceptions.h>
|
#include <libsolutil/Exceptions.h>
|
||||||
@ -54,17 +53,13 @@ enum class CheckResult
|
|||||||
SATISFIABLE, UNSATISFIABLE, UNKNOWN, CONFLICTING, ERROR
|
SATISFIABLE, UNSATISFIABLE, UNKNOWN, CONFLICTING, ERROR
|
||||||
};
|
};
|
||||||
|
|
||||||
// Forward declaration.
|
|
||||||
SortPointer smtSort(frontend::Type const& _type);
|
|
||||||
|
|
||||||
/// C++ representation of an SMTLIB2 expression.
|
/// C++ representation of an SMTLIB2 expression.
|
||||||
class Expression
|
class Expression
|
||||||
{
|
{
|
||||||
friend class SolverInterface;
|
friend class SolverInterface;
|
||||||
public:
|
public:
|
||||||
explicit Expression(bool _v): Expression(_v ? "true" : "false", Kind::Bool) {}
|
explicit Expression(bool _v): Expression(_v ? "true" : "false", Kind::Bool) {}
|
||||||
explicit Expression(frontend::TypePointer _type): Expression(_type->toString(true), {}, std::make_shared<SortSort>(smtSort(*_type))) {}
|
explicit Expression(std::shared_ptr<SortSort> _sort, std::string _name = ""): Expression(std::move(_name), {}, _sort) {}
|
||||||
explicit Expression(std::shared_ptr<SortSort> _sort): Expression("", {}, _sort) {}
|
|
||||||
Expression(size_t _number): Expression(std::to_string(_number), Kind::Int) {}
|
Expression(size_t _number): Expression(std::to_string(_number), Kind::Int) {}
|
||||||
Expression(u256 const& _number): Expression(_number.str(), Kind::Int) {}
|
Expression(u256 const& _number): Expression(_number.str(), Kind::Int) {}
|
||||||
Expression(s256 const& _number): Expression(_number.str(), Kind::Int) {}
|
Expression(s256 const& _number): Expression(_number.str(), Kind::Int) {}
|
||||||
|
@ -1061,8 +1061,9 @@ void SMTEncoder::arrayIndexAssignment(Expression const& _expr, smtutil::Expressi
|
|||||||
{
|
{
|
||||||
auto symbArray = dynamic_pointer_cast<smt::SymbolicArrayVariable>(m_context.expression(*base));
|
auto symbArray = dynamic_pointer_cast<smt::SymbolicArrayVariable>(m_context.expression(*base));
|
||||||
solAssert(symbArray, "");
|
solAssert(symbArray, "");
|
||||||
|
auto baseType = base->annotation().type;
|
||||||
toStore = smtutil::Expression::tuple_constructor(
|
toStore = smtutil::Expression::tuple_constructor(
|
||||||
smtutil::Expression(base->annotation().type),
|
smtutil::Expression(make_shared<smtutil::SortSort>(smt::smtSort(*baseType)), baseType->toString(true)),
|
||||||
{smtutil::Expression::store(symbArray->elements(), expr(*indexAccess->indexExpression()), toStore), symbArray->length()}
|
{smtutil::Expression::store(symbArray->elements(), expr(*indexAccess->indexExpression()), toStore), symbArray->length()}
|
||||||
);
|
);
|
||||||
indexAccess = base;
|
indexAccess = base;
|
||||||
|
@ -385,7 +385,10 @@ smtutil::Expression zeroValue(frontend::TypePointer const& _type)
|
|||||||
solAssert(false, "");
|
solAssert(false, "");
|
||||||
|
|
||||||
solAssert(zeroArray, "");
|
solAssert(zeroArray, "");
|
||||||
return smtutil::Expression::tuple_constructor(smtutil::Expression(_type), vector<smtutil::Expression>{*zeroArray, length});
|
return smtutil::Expression::tuple_constructor(
|
||||||
|
smtutil::Expression(std::make_shared<SortSort>(smtSort(*_type)), _type->toString(true)),
|
||||||
|
vector<smtutil::Expression>{*zeroArray, length}
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
solAssert(false, "");
|
solAssert(false, "");
|
||||||
|
Loading…
Reference in New Issue
Block a user