Merge pull request #10410 from ethereum/ir-fixedbytes-bitnot

Support BitNot on FixedBytes in IR
This commit is contained in:
chriseth
2020-11-26 14:42:52 +01:00
committed by GitHub
5 changed files with 106 additions and 1 deletions
@@ -693,10 +693,16 @@ void IRGeneratorForStatements::endVisit(UnaryOperation const& _unaryOperation)
else
solUnimplementedAssert(false, "Unary operator not yet implemented");
}
else if (resultType.category() == Type::Category::FixedBytes)
{
solAssert(op == Token::BitNot, "Only bitwise negation is allowed for FixedBytes");
solAssert(resultType == type(_unaryOperation.subExpression()), "Result type doesn't match!");
appendSimpleUnaryOperation(_unaryOperation, _unaryOperation.subExpression());
}
else if (resultType.category() == Type::Category::Bool)
{
solAssert(
_unaryOperation.getOperator() != Token::BitNot,
op != Token::BitNot,
"Bitwise Negation can't be done on bool!"
);