]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: Fatalf in Type.SetBroke(true) and Node.SetDiag(true)
authorMatthew Dempsky <mdempsky@google.com>
Wed, 16 Mar 2022 05:34:19 +0000 (22:34 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 16 Mar 2022 18:33:53 +0000 (18:33 +0000)
Type.Broke and Node.Diag were used in the legacy typechecker to allow
reporting of multiple errors in a compilation unit, while suppressing
unhelpful follow-on errors. However, that's no longer needed now that
types2 handles (most) user-visible diagnostics.

Updates #51691.

Change-Id: I919c1598d8acebe5703939256bdca3e8d021f7ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/392918
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
src/cmd/compile/internal/ir/mini.go
src/cmd/compile/internal/types/type.go

index eeb74081fb8bc51724e761f3579dc660416490bb..cfd5dcfb960fa3e080c723affaae4c2084fd9d40 100644 (file)
@@ -7,6 +7,7 @@
 package ir
 
 import (
+       "cmd/compile/internal/base"
        "cmd/compile/internal/types"
        "cmd/internal/src"
        "fmt"
@@ -56,7 +57,6 @@ func (n *miniNode) SetEsc(x uint16)   { n.esc = x }
 const (
        miniWalkdefShift   = 0 // TODO(mdempsky): Move to Name.flags.
        miniTypecheckShift = 2
-       miniDiag           = 1 << 4
        miniWalked         = 1 << 5 // to prevent/catch re-walking
 )
 
@@ -68,8 +68,8 @@ func (n *miniNode) SetTypecheck(x uint8) {
        n.bits.set2(miniTypecheckShift, x)
 }
 
-func (n *miniNode) Diag() bool     { return n.bits&miniDiag != 0 }
-func (n *miniNode) SetDiag(x bool) { n.bits.set(miniDiag, x) }
+func (n *miniNode) Diag() bool     { return false }
+func (n *miniNode) SetDiag(x bool) { base.AssertfAt(!x, n.Pos(), "SetDiag") }
 
 func (n *miniNode) Walked() bool     { return n.bits&miniWalked != 0 }
 func (n *miniNode) SetWalked(x bool) { n.bits.set(miniWalked, x) }
index fe352e0b6e03ebb1d904b54414f498d0feeb8dbe..51ce614bd8a70ed2d8240e2dc1509532a9e5314a 100644 (file)
@@ -212,7 +212,6 @@ func (*Type) CanBeAnSSAAux() {}
 
 const (
        typeNotInHeap  = 1 << iota // type cannot be heap allocated
-       typeBroke                  // broken type definition
        typeNoalg                  // suppress hash and eq algorithm generation
        typeDeferwidth             // width computation has been deferred and type is on deferredTypeStack
        typeRecur
@@ -222,7 +221,7 @@ const (
 )
 
 func (t *Type) NotInHeap() bool  { return t.flags&typeNotInHeap != 0 }
-func (t *Type) Broke() bool      { return t.flags&typeBroke != 0 }
+func (t *Type) Broke() bool      { return false }
 func (t *Type) Noalg() bool      { return t.flags&typeNoalg != 0 }
 func (t *Type) Deferwidth() bool { return t.flags&typeDeferwidth != 0 }
 func (t *Type) Recur() bool      { return t.flags&typeRecur != 0 }
@@ -231,7 +230,7 @@ func (t *Type) IsShape() bool    { return t.flags&typeIsShape != 0 }
 func (t *Type) HasShape() bool   { return t.flags&typeHasShape != 0 }
 
 func (t *Type) SetNotInHeap(b bool)  { t.flags.set(typeNotInHeap, b) }
-func (t *Type) SetBroke(b bool)      { t.flags.set(typeBroke, b) }
+func (t *Type) SetBroke(b bool)      { base.Assertf(!b, "SetBroke") }
 func (t *Type) SetNoalg(b bool)      { t.flags.set(typeNoalg, b) }
 func (t *Type) SetDeferwidth(b bool) { t.flags.set(typeDeferwidth, b) }
 func (t *Type) SetRecur(b bool)      { t.flags.set(typeRecur, b) }