1
0
mirror of https://github.com/golang/go synced 2024-11-23 13:30:08 -07:00

cmd/compile: rename types.IdealFoo to types.UntypedFoo

To be consistent with go/types.

Passes toolstash-check.

Change-Id: I5e02f529064a904310a164f8765082aa533cc799
Reviewed-on: https://go-review.googlesource.com/c/go/+/260699
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Cuong Manh Le 2020-10-08 20:33:36 +07:00
parent f3b58edd03
commit 46ab0c0c04
10 changed files with 58 additions and 58 deletions

View File

@ -160,12 +160,12 @@ func predeclared() []*types.Type {
types.Errortype,
// untyped types
types.Idealbool,
types.Idealint,
types.Idealrune,
types.Idealfloat,
types.Idealcomplex,
types.Idealstring,
types.UntypedBool,
types.UntypedInt,
types.UntypedRune,
types.UntypedFloat,
types.UntypedComplex,
types.UntypedString,
types.Types[TNIL],
// package unsafe

View File

@ -1019,17 +1019,17 @@ func nodlit(v Val) *Node {
func idealType(ct Ctype) *types.Type {
switch ct {
case CTSTR:
return types.Idealstring
return types.UntypedString
case CTBOOL:
return types.Idealbool
return types.UntypedBool
case CTINT:
return types.Idealint
return types.UntypedInt
case CTRUNE:
return types.Idealrune
return types.UntypedRune
case CTFLT:
return types.Idealfloat
return types.UntypedFloat
case CTCPLX:
return types.Idealcomplex
return types.UntypedComplex
case CTNIL:
return types.Types[TNIL]
}
@ -1080,17 +1080,17 @@ func defaultlit2(l *Node, r *Node, force bool) (*Node, *Node) {
func ctype(t *types.Type) Ctype {
switch t {
case types.Idealbool:
case types.UntypedBool:
return CTBOOL
case types.Idealstring:
case types.UntypedString:
return CTSTR
case types.Idealint:
case types.UntypedInt:
return CTINT
case types.Idealrune:
case types.UntypedRune:
return CTRUNE
case types.Idealfloat:
case types.UntypedFloat:
return CTFLT
case types.Idealcomplex:
case types.UntypedComplex:
return CTCPLX
}
Fatalf("bad type %v", t)
@ -1111,17 +1111,17 @@ func defaultType(t *types.Type) *types.Type {
}
switch t {
case types.Idealbool:
case types.UntypedBool:
return types.Types[TBOOL]
case types.Idealstring:
case types.UntypedString:
return types.Types[TSTRING]
case types.Idealint:
case types.UntypedInt:
return types.Types[TINT]
case types.Idealrune:
case types.UntypedRune:
return types.Runetype
case types.Idealfloat:
case types.UntypedFloat:
return types.Types[TFLOAT64]
case types.Idealcomplex:
case types.UntypedComplex:
return types.Types[TCOMPLEX128]
}

View File

@ -773,17 +773,17 @@ func tconv2(b *bytes.Buffer, t *types.Type, flag FmtFlag, mode fmtMode, visited
if int(t.Etype) < len(basicnames) && basicnames[t.Etype] != "" {
var name string
switch t {
case types.Idealbool:
case types.UntypedBool:
name = "untyped bool"
case types.Idealstring:
case types.UntypedString:
name = "untyped string"
case types.Idealint:
case types.UntypedInt:
name = "untyped int"
case types.Idealrune:
case types.UntypedRune:
name = "untyped rune"
case types.Idealfloat:
case types.UntypedFloat:
name = "untyped float"
case types.Idealcomplex:
case types.UntypedComplex:
name = "untyped complex"
default:
name = basicnames[t.Etype]
@ -1333,7 +1333,7 @@ func (n *Node) exprfmt(s fmt.State, prec int, mode fmtMode) {
n.Orig.exprfmt(s, prec, mode)
return
}
if n.Type != nil && n.Type.Etype != TIDEAL && n.Type.Etype != TNIL && n.Type != types.Idealbool && n.Type != types.Idealstring {
if n.Type != nil && n.Type.Etype != TIDEAL && n.Type.Etype != TNIL && n.Type != types.UntypedBool && n.Type != types.UntypedString {
// Need parens when type begins with what might
// be misinterpreted as a unary operator: * or <-.
if n.Type.IsPtr() || (n.Type.IsChan() && n.Type.ChanDir() == types.Crecv) {

View File

@ -751,11 +751,11 @@ func (w *exportWriter) param(f *types.Field) {
func constTypeOf(typ *types.Type) Ctype {
switch typ {
case types.Idealint, types.Idealrune:
case types.UntypedInt, types.UntypedRune:
return CTINT
case types.Idealfloat:
case types.UntypedFloat:
return CTFLT
case types.Idealcomplex:
case types.UntypedComplex:
return CTCPLX
}

View File

@ -375,7 +375,7 @@ func (p *importReader) value() (typ *types.Type, v Val) {
v.U = p.string()
case CTINT:
x := new(Mpint)
x.Rune = typ == types.Idealrune
x.Rune = typ == types.UntypedRune
p.mpint(&x.Val, typ)
v.U = x
case CTFLT:

View File

@ -50,12 +50,12 @@ func initssaconfig() {
// Caching is disabled in the backend, so generating these here avoids allocations.
_ = types.NewPtr(types.Types[TINTER]) // *interface{}
_ = types.NewPtr(types.NewPtr(types.Types[TSTRING])) // **string
_ = types.NewPtr(types.NewPtr(types.Idealstring)) // **string
_ = types.NewPtr(types.NewPtr(types.UntypedString)) // **string
_ = types.NewPtr(types.NewSlice(types.Types[TINTER])) // *[]interface{}
_ = types.NewPtr(types.NewPtr(types.Bytetype)) // **byte
_ = types.NewPtr(types.NewSlice(types.Bytetype)) // *[]byte
_ = types.NewPtr(types.NewSlice(types.Types[TSTRING])) // *[]string
_ = types.NewPtr(types.NewSlice(types.Idealstring)) // *[]string
_ = types.NewPtr(types.NewSlice(types.UntypedString)) // *[]string
_ = types.NewPtr(types.NewPtr(types.NewPtr(types.Types[TUINT8]))) // ***uint8
_ = types.NewPtr(types.Types[TINT16]) // *int16
_ = types.NewPtr(types.Types[TINT64]) // *int64

View File

@ -825,7 +825,7 @@ func assignconvfn(n *Node, t *types.Type, context func() string) *Node {
// Convert ideal bool from comparison to plain bool
// if the next step is non-bool (like interface{}).
if n.Type == types.Idealbool && !t.IsBoolean() {
if n.Type == types.UntypedBool && !t.IsBoolean() {
if n.Op == ONAME || n.Op == OLITERAL {
r := nod(OCONVNOP, n, nil)
r.Type = types.Types[TBOOL]

View File

@ -361,7 +361,7 @@ func typecheck1(n *Node, top int) (res *Node) {
ok |= ctxExpr
if n.Type == nil && n.Val().Ctype() == CTSTR {
n.Type = types.Idealstring
n.Type = types.UntypedString
}
case ONONAME:
@ -623,8 +623,8 @@ func typecheck1(n *Node, top int) (res *Node) {
// no defaultlit for left
// the outer context gives the type
n.Type = l.Type
if (l.Type == types.Idealfloat || l.Type == types.Idealcomplex) && r.Op == OLITERAL {
n.Type = types.Idealint
if (l.Type == types.UntypedFloat || l.Type == types.UntypedComplex) && r.Op == OLITERAL {
n.Type = types.UntypedInt
}
break
@ -777,7 +777,7 @@ func typecheck1(n *Node, top int) (res *Node) {
if iscmp[n.Op] {
evconst(n)
t = types.Idealbool
t = types.UntypedBool
if n.Op != OLITERAL {
l, r = defaultlit2(l, r, true)
n.Left = l
@ -1458,7 +1458,7 @@ func typecheck1(n *Node, top int) (res *Node) {
// Determine result type.
switch t.Etype {
case TIDEAL:
n.Type = types.Idealfloat
n.Type = types.UntypedFloat
case TCOMPLEX64:
n.Type = types.Types[TFLOAT32]
case TCOMPLEX128:
@ -1504,7 +1504,7 @@ func typecheck1(n *Node, top int) (res *Node) {
return n
case TIDEAL:
t = types.Idealcomplex
t = types.UntypedComplex
case TFLOAT32:
t = types.Types[TCOMPLEX64]
@ -2724,9 +2724,9 @@ func errorDetails(nl Nodes, tstruct *types.Type, isddd bool) string {
// e.g in error messages about wrong arguments to return.
func sigrepr(t *types.Type, isddd bool) string {
switch t {
case types.Idealstring:
case types.UntypedString:
return "string"
case types.Idealbool:
case types.UntypedBool:
return "bool"
}

View File

@ -123,21 +123,21 @@ func lexinit() {
asNode(s2.Def).SetSubOp(s.op)
}
types.Idealstring = types.New(TSTRING)
types.Idealbool = types.New(TBOOL)
types.UntypedString = types.New(TSTRING)
types.UntypedBool = types.New(TBOOL)
types.Types[TANY] = types.New(TANY)
s := builtinpkg.Lookup("true")
s.Def = asTypesNode(nodbool(true))
asNode(s.Def).Sym = lookup("true")
asNode(s.Def).Name = new(Name)
asNode(s.Def).Type = types.Idealbool
asNode(s.Def).Type = types.UntypedBool
s = builtinpkg.Lookup("false")
s.Def = asTypesNode(nodbool(false))
asNode(s.Def).Sym = lookup("false")
asNode(s.Def).Name = new(Name)
asNode(s.Def).Type = types.Idealbool
asNode(s.Def).Type = types.UntypedBool
s = lookup("_")
s.Block = -100
@ -351,7 +351,7 @@ func typeinit() {
sizeofString = Rnd(sliceLenOffset+int64(Widthptr), int64(Widthptr))
dowidth(types.Types[TSTRING])
dowidth(types.Idealstring)
dowidth(types.UntypedString)
}
func makeErrorInterface() *types.Type {

View File

@ -105,14 +105,14 @@ var (
Errortype *Type
// Types to represent untyped string and boolean constants.
Idealstring *Type
Idealbool *Type
UntypedString *Type
UntypedBool *Type
// Types to represent untyped numeric constants.
Idealint = New(TIDEAL)
Idealrune = New(TIDEAL)
Idealfloat = New(TIDEAL)
Idealcomplex = New(TIDEAL)
UntypedInt = New(TIDEAL)
UntypedRune = New(TIDEAL)
UntypedFloat = New(TIDEAL)
UntypedComplex = New(TIDEAL)
)
// A Type represents a Go type.
@ -1436,7 +1436,7 @@ func (t *Type) IsUntyped() bool {
if t == nil {
return false
}
if t == Idealstring || t == Idealbool {
if t == UntypedString || t == UntypedBool {
return true
}
switch t.Etype {