Merge pull request #8796 from a3d4/fix-8760-typechecker-compiler-error

[Type Checker] Fix internal error when applying unary operators to tuples with empty components
This commit is contained in:
chriseth
2020-04-29 10:14:15 +02:00
committed by GitHub
7 changed files with 65 additions and 7 deletions
+7 -7
View File
@@ -1478,13 +1478,13 @@ bool TypeChecker::visit(UnaryOperation const& _operation)
TypePointer t = type(_operation.subExpression())->unaryOperatorResult(op);
if (!t)
{
m_errorReporter.typeError(
_operation.location(),
"Unary operator " +
string(TokenTraits::toString(op)) +
" cannot be applied to type " +
subExprType->toString()
);
string description = "Unary operator " + string(TokenTraits::toString(op)) + " cannot be applied to type " + subExprType->toString();
if (modifying)
// Cannot just report the error, ignore the unary operator, and continue,
// because the sub-expression was already processed with requireLValue()
m_errorReporter.fatalTypeError(_operation.location(), description);
else
m_errorReporter.typeError(_operation.location(), description);
t = subExprType;
}
_operation.annotation().type = t;