Simplifies Result<T> and prevents undefined behaviour.

This commit is contained in:
Erik Kundt
2018-12-05 10:33:34 +01:00
parent 05e74d096e
commit e3accc6aa6
2 changed files with 12 additions and 29 deletions
+3 -3
View File
@@ -611,14 +611,14 @@ TypeResult IntegerType::unaryOperatorResult(Token _operator) const
{
// "delete" is ok for all integer types
if (_operator == Token::Delete)
return TypeResult::Ok(make_shared<TupleType>());
return TypeResult{make_shared<TupleType>()};
// we allow +, -, ++ and --
else if (_operator == Token::Add || _operator == Token::Sub ||
_operator == Token::Inc || _operator == Token::Dec ||
_operator == Token::BitNot)
return TypeResult::Ok(shared_from_this());
return TypeResult{shared_from_this()};
else
return TypeResult::Err();
return TypeResult{""};
}
bool IntegerType::operator==(Type const& _other) const