cmd/compile: remove types.Field.{Broken,SetBroken}

SetBroken is never called and Broken always returns false.

Updates #51691

Change-Id: I7e3fd3f2121268596d2e93a28c69e895bcf802ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/394558
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Cuong Manh Le 2022-03-23 01:27:11 +07:00
parent 2792a414c6
commit 0eb2c77124
4 changed files with 3 additions and 9 deletions

View file

@ -608,8 +608,8 @@ func tcSwitchType(n *ir.SwitchStmt) {
base.ErrorfAt(ncase.Pos(), "%L is not a type", n1)
continue
}
if !n1.Type().IsInterface() && !implements(n1.Type(), t, &missing, &have, &ptr) && !missing.Broke() {
if have != nil && !have.Broke() {
if !n1.Type().IsInterface() && !implements(n1.Type(), t, &missing, &have, &ptr) {
if have != nil {
base.ErrorfAt(ncase.Pos(), "impossible type switch case: %L cannot have dynamic type %v"+
" (wrong type for %v method)\n\thave %v%S\n\twant %v%S", guard.X, n1.Type(), missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type)
} else if ptr != 0 {

View file

@ -774,9 +774,6 @@ func implements(t, iface *types.Type, m, samename **types.Field, ptr *int) bool
}
i := 0
for _, im := range iface.AllMethods().Slice() {
if im.Broke() {
continue
}
for i < len(tms) && tms[i].Sym != im.Sym {
i++
}

View file

@ -1135,7 +1135,7 @@ func Lookdot(n *ir.SelectorExpr, t *types.Type, dostrcmp int) *types.Field {
}
if f1 != nil {
if dostrcmp > 1 || f1.Broke() {
if dostrcmp > 1 {
// Already in the process of diagnosing an error.
return f1
}

View file

@ -521,16 +521,13 @@ type Field struct {
const (
fieldIsDDD = 1 << iota // field is ... argument
fieldBroke // broken field definition
fieldNointerface
)
func (f *Field) IsDDD() bool { return f.flags&fieldIsDDD != 0 }
func (f *Field) Broke() bool { return f.flags&fieldBroke != 0 }
func (f *Field) Nointerface() bool { return f.flags&fieldNointerface != 0 }
func (f *Field) SetIsDDD(b bool) { f.flags.set(fieldIsDDD, b) }
func (f *Field) SetBroke(b bool) { f.flags.set(fieldBroke, b) }
func (f *Field) SetNointerface(b bool) { f.flags.set(fieldNointerface, b) }
// End returns the offset of the first byte immediately after this field.