From bb34185432e55fd6ccfbab6dffaf483225abeb03 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Mon, 29 Jul 2013 13:07:46 -0700 Subject: [PATCH] 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 --- go/types/selection.go | 4 ++-- go/types/testdata/const1.src | 38 +++++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/go/types/selection.go b/go/types/selection.go index fb71d47a..8d4f1582 100644 --- a/go/types/selection.go +++ b/go/types/selection.go @@ -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 diff --git a/go/types/testdata/const1.src b/go/types/testdata/const1.src index e528cb07..0232f452 100644 --- a/go/types/testdata/const1.src +++ b/go/types/testdata/const1.src @@ -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<