Port of https://go-review.googlesource.com/11365
Fixes #11357.
Change-Id: Icd20fa038696a8853d1d14477e1c1132938b3e2e
Reviewed-on: https://go-review.googlesource.com/11368
Reviewed-by: Alan Donovan <adonovan@google.com>
switch t := T.Underlying().(*Basic); {
case representableConst(x.val, check.conf, t.kind, &x.val):
ok = true
- case x.isInteger() && isString(t):
+ case isInteger(x.typ) && isString(t):
codepoint := int64(-1)
if i, ok := exact.Int64Val(x.val); ok {
codepoint = i
const _ = string(true /* ERROR "cannot convert" */ )
const _ = string(1.2 /* ERROR "cannot convert" */ )
const _ = string(nil /* ERROR "cannot convert" */ )
+
+ // issues 11357, 11353: argument must be of integer type
+ _ = string(0.0 /* ERROR "cannot convert" */ )
+ _ = string(0i /* ERROR "cannot convert" */ )
+ _ = string(1 /* ERROR "cannot convert" */ + 2i)
}
func interface_conversions() {