Use the Key position of a syntax.KeyValueExpr (not the position of the
":") when reporting an error for a missing key.
(In go/types, the KeyValueExpr position is the start of the expression
not the ":", so there this works as expected.)
Change-Id: I74147d245927847274cf4e53b4f03dbb5110c324
Reviewed-on: https://go-review.googlesource.com/c/go/+/276813
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
i := fieldIndex(utyp.fields, check.pkg, key.Value)
if i < 0 {
if check.conf.CompilerErrorMessages {
- check.errorf(kv, "unknown field '%s' in struct literal of type %s", key.Value, base)
+ check.errorf(kv.Key, "unknown field '%s' in struct literal of type %s", key.Value, base)
} else {
- check.errorf(kv, "unknown field %s in struct literal", key.Value)
+ check.errorf(kv.Key, "unknown field %s in struct literal", key.Value)
}
continue
}
"fixedbugs/issue22200.go": true, // types2 doesn't produce "stack frame too large" error
"fixedbugs/issue22200b.go": true, // types2 doesn't produce "stack frame too large" error
"fixedbugs/issue23732.go": true, // types2 reports different (but ok) line numbers
- "fixedbugs/issue24339.go": true, // types2 reports wrong line number
"fixedbugs/issue25507.go": true, // types2 doesn't produce "stack frame too large" error
"fixedbugs/issue25958.go": true, // types2 doesn't report a follow-on error (pref: types2)
"fixedbugs/issue28079b.go": true, // types2 reports follow-on errors