aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/unify.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-06-28 16:00:26 -0700
committerRobert Griesemer <gri@golang.org>2021-06-30 18:59:30 +0000
commit1ff43d1b179eb96a34b9007e10d78e2278643f3f (patch)
treea72507fb7190393602c19d537a12930d54729b4f /src/cmd/compile/internal/types2/unify.go
parent4b5fdb0b7a362cb6fa6ad551757104e490483121 (diff)
downloadgo-1ff43d1b179eb96a34b9007e10d78e2278643f3f.tar.gz
go-1ff43d1b179eb96a34b9007e10d78e2278643f3f.zip
[dev.typeparams] cmd/compile/internal/types2: remove unused *Checker arguments (cleanup)
Simplified names and unnecessary function indirections where possible. Change-Id: I1c7a386393d086fd7ad29f892e03f048781f3547 Reviewed-on: https://go-review.googlesource.com/c/go/+/331512 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/unify.go')
-rw-r--r--src/cmd/compile/internal/types2/unify.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/cmd/compile/internal/types2/unify.go b/src/cmd/compile/internal/types2/unify.go
index 9a51dcb6d4..4e1f832203 100644
--- a/src/cmd/compile/internal/types2/unify.go
+++ b/src/cmd/compile/internal/types2/unify.go
@@ -6,7 +6,10 @@
package types2
-import "bytes"
+import (
+ "bytes"
+ "fmt"
+)
// The unifier maintains two separate sets of type parameters x and y
// which are used to resolve type parameters in the x and y arguments
@@ -34,7 +37,6 @@ import "bytes"
// and the respective types inferred for each type parameter.
// A unifier is created by calling newUnifier.
type unifier struct {
- check *Checker
exact bool
x, y tparamsList // x and y must initialized via tparamsList.init
types []Type // inferred types, shared by x and y
@@ -45,8 +47,8 @@ type unifier struct {
// exactly. If exact is not set, a named type's underlying type
// is considered if unification would fail otherwise, and the
// direction of channels is ignored.
-func newUnifier(check *Checker, exact bool) *unifier {
- u := &unifier{check: check, exact: exact}
+func newUnifier(exact bool) *unifier {
+ u := &unifier{exact: exact}
u.x.unifier = u
u.y.unifier = u
return u
@@ -453,8 +455,7 @@ func (u *unifier) nify(x, y Type, p *ifacePair) bool {
// avoid a crash in case of nil type
default:
- u.check.dump("### u.nify(%s, %s), u.x.tparams = %s", x, y, u.x.tparams)
- unreachable()
+ panic(fmt.Sprintf("### u.nify(%s, %s), u.x.tparams = %s", x, y, u.x.tparams))
}
return false