mirror of
https://github.com/golang/go
synced 2024-11-18 16:14:46 -07:00
go.tools/go/types: more implicit conversion tests
Also: Fixed grammar in selection.go comment. R=adonovan CC=golang-dev https://golang.org/cl/11962043
This commit is contained in:
parent
fb0642f5fb
commit
bb34185432
@ -76,8 +76,8 @@ func (s *Selection) Obj() Object { return s.obj }
|
||||
func (s *Selection) Type() Type {
|
||||
switch s.kind {
|
||||
case MethodVal:
|
||||
// The type of x.f is a method with its receiver type to the
|
||||
// type of x.
|
||||
// The type of x.f is a method with its receiver type set
|
||||
// to the type of x.
|
||||
sig := *s.obj.(*Func).typ.(*Signature)
|
||||
recv := *sig.recv
|
||||
recv.typ = s.recv
|
||||
|
38
go/types/testdata/const1.src
vendored
38
go/types/testdata/const1.src
vendored
@ -6,13 +6,22 @@
|
||||
|
||||
package const1
|
||||
|
||||
// TODO(gri) add int/uint/uintptr sizes and tests
|
||||
const(
|
||||
mi = ^int(0)
|
||||
mu = ^uint(0)
|
||||
mp = ^uintptr(0)
|
||||
|
||||
logSizeofInt = uint(mi>>8&1 + mi>>16&1 + mi>>32&1)
|
||||
logSizeofUint = uint(mu>>8&1 + mu>>16&1 + mu>>32&1)
|
||||
logSizeofUintptr = uint(mp>>8&1 + mp>>16&1 + mp>>32&1)
|
||||
)
|
||||
|
||||
const (
|
||||
minInt8 = -1<<(8<<iota - 1)
|
||||
minInt16
|
||||
minInt32
|
||||
minInt64
|
||||
minInt = -1<<(8<<logSizeofInt - 1)
|
||||
)
|
||||
|
||||
const (
|
||||
@ -20,6 +29,7 @@ const (
|
||||
maxInt16
|
||||
maxInt32
|
||||
maxInt64
|
||||
maxInt = 1<<(8<<logSizeofInt - 1) - 1
|
||||
)
|
||||
|
||||
const (
|
||||
@ -27,6 +37,8 @@ const (
|
||||
maxUint16
|
||||
maxUint32
|
||||
maxUint64
|
||||
maxUint = 1<<(8<<logSizeofUint) - 1
|
||||
maxUintptr = 1<<(8<<logSizeofUintptr) - 1
|
||||
)
|
||||
|
||||
const (
|
||||
@ -76,6 +88,14 @@ var (
|
||||
_ int64 = smallestFloat64 /* ERROR "overflows" */
|
||||
)
|
||||
|
||||
var (
|
||||
_ int = minInt /* ERROR "overflows" */ - 1
|
||||
_ int = minInt
|
||||
_ int = maxInt
|
||||
_ int = maxInt /* ERROR "overflows" */ + 1
|
||||
_ int = smallestFloat64 /* ERROR "overflows" */
|
||||
)
|
||||
|
||||
var (
|
||||
_ uint8 = 0 /* ERROR "overflows" */ - 1
|
||||
_ uint8 = 0
|
||||
@ -108,6 +128,22 @@ var (
|
||||
_ uint64 = smallestFloat64 /* ERROR "overflows" */
|
||||
)
|
||||
|
||||
var (
|
||||
_ uint = 0 /* ERROR "overflows" */ - 1
|
||||
_ uint = 0
|
||||
_ uint = maxUint
|
||||
_ uint = maxUint /* ERROR "overflows" */ + 1
|
||||
_ uint = smallestFloat64 /* ERROR "overflows" */
|
||||
)
|
||||
|
||||
var (
|
||||
_ uintptr = 0 /* ERROR "overflows" */ - 1
|
||||
_ uintptr = 0
|
||||
_ uintptr = maxUintptr
|
||||
_ uintptr = maxUintptr /* ERROR "overflows" */ + 1
|
||||
_ uintptr = smallestFloat64 /* ERROR "overflows" */
|
||||
)
|
||||
|
||||
var (
|
||||
_ float32 = minInt64
|
||||
_ float64 = minInt64
|
||||
|
Loading…
Reference in New Issue
Block a user