Improved diagnostics with more detailed type names.

This commit is contained in:
acqn
2020-08-03 01:16:00 +08:00
committed by Oliver Schmidt
parent 11a5f0edf1
commit 6df4f1996b
5 changed files with 13 additions and 7 deletions

View File

@@ -127,7 +127,13 @@ void Assignment (ExprDesc* Expr)
/* We must have an lvalue for an assignment */
if (ED_IsRVal (Expr)) {
Error ("Invalid lvalue in assignment");
if (IsTypeArray (Expr->Type)) {
Error ("Array type '%s' is not assignable", GetFullTypeName (Expr->Type));
} else if (IsTypeFunc (Expr->Type)) {
Error ("Function type '%s' is not assignable", GetFullTypeName (Expr->Type));
} else {
Error ("Assignment to rvalue");
}
}
/* Check for assignment to const */