aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/type.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2020-12-28 23:42:49 -0800
committerMatthew Dempsky <mdempsky@google.com>2020-12-29 08:22:45 +0000
commit33801cdc627bc4d3f7128d1076a1ac249da2e015 (patch)
tree3e99cf079127c5aaf822a41c685c53096af6e240 /src/cmd/compile/internal/typecheck/type.go
parent82ad3083f86947eece2e4ce2ae82f1230aa466d9 (diff)
downloadgo-33801cdc627bc4d3f7128d1076a1ac249da2e015.tar.gz
go-33801cdc627bc4d3f7128d1076a1ac249da2e015.zip
[dev.regabi] cmd/compile: use Ntype where possible
For nodes that are always a type expression, we can use Ntype instead of Node. Passes toolstash -cmp. Change-Id: I28f9fa235015ab48d0da06b78b30c49d74c64e3a Reviewed-on: https://go-review.googlesource.com/c/go/+/280642 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/type.go')
-rw-r--r--src/cmd/compile/internal/typecheck/type.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cmd/compile/internal/typecheck/type.go b/src/cmd/compile/internal/typecheck/type.go
index 0c2ebb8b26..6fdafef77d 100644
--- a/src/cmd/compile/internal/typecheck/type.go
+++ b/src/cmd/compile/internal/typecheck/type.go
@@ -14,7 +14,7 @@ import (
// tcArrayType typechecks an OTARRAY node.
func tcArrayType(n *ir.ArrayType) ir.Node {
- n.Elem = typecheck(n.Elem, ctxType)
+ n.Elem = typecheckNtype(n.Elem)
if n.Elem.Type() == nil {
return n
}
@@ -59,7 +59,7 @@ func tcArrayType(n *ir.ArrayType) ir.Node {
// tcChanType typechecks an OTCHAN node.
func tcChanType(n *ir.ChanType) ir.Node {
- n.Elem = typecheck(n.Elem, ctxType)
+ n.Elem = typecheckNtype(n.Elem)
l := n.Elem
if l.Type() == nil {
return n
@@ -103,7 +103,7 @@ func tcInterfaceType(n *ir.InterfaceType) ir.Node {
n.SetOTYPE(types.Types[types.TINTER])
return n
}
-
+
lno := base.Pos
methods := tcFields(n.Methods, nil)
base.Pos = lno
@@ -114,8 +114,8 @@ func tcInterfaceType(n *ir.InterfaceType) ir.Node {
// tcMapType typechecks an OTMAP node.
func tcMapType(n *ir.MapType) ir.Node {
- n.Key = typecheck(n.Key, ctxType)
- n.Elem = typecheck(n.Elem, ctxType)
+ n.Key = typecheckNtype(n.Key)
+ n.Elem = typecheckNtype(n.Elem)
l := n.Key
r := n.Elem
if l.Type() == nil || r.Type() == nil {
@@ -134,7 +134,7 @@ func tcMapType(n *ir.MapType) ir.Node {
// tcSliceType typechecks an OTSLICE node.
func tcSliceType(n *ir.SliceType) ir.Node {
- n.Elem = typecheck(n.Elem, ctxType)
+ n.Elem = typecheckNtype(n.Elem)
if n.Elem.Type() == nil {
return n
}