Support BitNot on FixedBytes in IR

This commit is contained in:
Alex Beregszaszi
2020-11-26 13:20:02 +00:00
parent 5f732cb3ca
commit cbae5ca324
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!"
);