This is port of CL 357229 for types2 to go/types.
Change-Id: I35ed6b784969210a00ea5b36238df7d6b7fa18bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/357230
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
if e != nil {
posn = e
}
- check.invalidOp(posn, _MismatchedTypes, "%s (mismatched types %s and %s)", e, x.typ, y.typ)
+ if e != nil {
+ check.invalidOp(posn, _MismatchedTypes, "%s (mismatched types %s and %s)", e, x.typ, y.typ)
+ } else {
+ check.invalidOp(posn, _MismatchedTypes, "%s %s= %s (mismatched types %s and %s)", lhs, op, rhs, x.typ, y.typ)
+ }
}
x.mode = invalid
return
var i int
_ = s /* ERROR invalid operation: s \+ i \(mismatched types string and int\) */ + i
}
+
+func f(i int) int {
+ i /* ERROR invalid operation: i \+= "1" \(mismatched types int and untyped string\) */ += "1"
+ return i
+}