diff options
Diffstat (limited to 'src/parse.cff')
| -rw-r--r-- | src/parse.cff | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/parse.cff b/src/parse.cff index b978f4b..ea965d6 100644 --- a/src/parse.cff +++ b/src/parse.cff @@ -2134,8 +2134,14 @@ fn pexassign(P *Parser) Expr { case (typeof2(ex.ty, rhs.ty) == #null) and !((ex.ty->is(:Ptr) and rhs.ty->is(:Int) and (tok.t == '+=' or tok.t == '-='))); - err(P, ex.loc, - "operands %t and %t to assignment operator %qT have incompatible types", + err(P, tok.loc, "invalid operands %t and %t for assignment operator %qT", + ex.ty, rhs.ty, tok); + case okind == :IntFlo and (!isnumtype(ex.ty) or !isnumtype(rhs.ty)); + err(P, tok.loc, "invalid operands %t and %t for assignment operator %qT", + ex.ty, rhs.ty, tok); + + case okind == :Int and (!ex.ty->is(:Int) or !rhs.ty->is(:Int)); + err(P, tok.loc, "invalid operands %t and %t for assignment operator %qT", ex.ty, rhs.ty, tok); case ex.ty.konst; err(P, ex.loc, "left operand to assignment is const"); |