]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove types.Field.{Broken,SetBroken}
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Tue, 22 Mar 2022 18:27:11 +0000 (01:27 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Wed, 23 Mar 2022 19:31:50 +0000 (19:31 +0000)
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>

src/cmd/compile/internal/typecheck/stmt.go
src/cmd/compile/internal/typecheck/subr.go
src/cmd/compile/internal/typecheck/typecheck.go
src/cmd/compile/internal/types/type.go

index a6ff84e7f6ea7744946961b57cb834bbc433b7f6..16e24a049177fb3c3cb84af9d19e0cc1b8226a28 100644 (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 {
index 4dd95475f0567a7b43944f43faa0c3a657d9ed1d..e9690a55510f7415c515eb5f21b2ee61c3094851 100644 (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++
                }
index 6dd3333eb0d776d1defa048afba3e59939e9665d..b5108eab847d4c30deb5421cd46125f5a4091f6d 100644 (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
                }
index e3bfc2410827c075f65c2b58de3761f69d34eff0..098ce385c47b9077b0ff015afa3bef6cf513443e 100644 (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.