aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/test
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-07-07 16:15:53 -0700
committerMatthew Dempsky <mdempsky@google.com>2021-07-08 19:50:12 +0000
commit42fe1327878dc0956d2c6407a54112fa5e75bd34 (patch)
tree39bcf3ea6d818e294719782c53a29e4309839943 /src/cmd/compile/internal/test
parentd4f6d161e439b3c2a56a4583d4b5acebe3fdeeee (diff)
downloadgo-42fe1327878dc0956d2c6407a54112fa5e75bd34.tar.gz
go-42fe1327878dc0956d2c6407a54112fa5e75bd34.zip
[dev.typeparams] cmd/compile: cleanup ABI utils tests
This CL cleans a few minor nits with the ABI utils tests that are now necessary because of cleanups that happened on master: 1. Initialize types.LocalPkg; this needs to be set for selector names to be handled correctly. 2. In TestABIUtilsInterfaces, switch to using an exported identifier, so it doesn't need to be package qualified. 3. While here, change the method result type from "untyped string" to just "string". Constants are the only declared object that can ever have an untyped type. Change-Id: Iabed46594361a516317a1c2d20c3d59bdb519844 Reviewed-on: https://go-review.googlesource.com/c/go/+/333189 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/cmd/compile/internal/test')
-rw-r--r--src/cmd/compile/internal/test/abiutils_test.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/test/abiutils_test.go b/src/cmd/compile/internal/test/abiutils_test.go
index b7901be69b..839546bcb8 100644
--- a/src/cmd/compile/internal/test/abiutils_test.go
+++ b/src/cmd/compile/internal/test/abiutils_test.go
@@ -33,6 +33,8 @@ func TestMain(m *testing.M) {
base.Ctxt.DiagFunc = base.Errorf
base.Ctxt.DiagFlush = base.FlushErrors
base.Ctxt.Bso = bufio.NewWriter(os.Stdout)
+ types.LocalPkg = types.NewPkg("", "local")
+ types.LocalPkg.Prefix = `""`
types.PtrSize = ssagen.Arch.LinkArch.PtrSize
types.RegSize = ssagen.Arch.LinkArch.RegSize
typecheck.InitUniverse()
@@ -309,8 +311,8 @@ func TestABIUtilsInterfaces(t *testing.T) {
ei := types.Types[types.TINTER] // interface{}
pei := types.NewPtr(ei) // *interface{}
fldt := mkFuncType(types.FakeRecvType(), []*types.Type{},
- []*types.Type{types.UntypedString})
- field := types.NewField(src.NoXPos, typecheck.Lookup("f"), fldt)
+ []*types.Type{types.Types[types.TSTRING]})
+ field := types.NewField(src.NoXPos, typecheck.Lookup("F"), fldt)
nei := types.NewInterface(types.LocalPkg, []*types.Field{field})
i16 := types.Types[types.TINT16]
tb := types.Types[types.TBOOL]
@@ -322,12 +324,12 @@ func TestABIUtilsInterfaces(t *testing.T) {
IN 0: R{ I0 I1 I2 } spilloffset: 0 typ: struct { int16; int16; bool }
IN 1: R{ I3 I4 } spilloffset: 8 typ: interface {}
IN 2: R{ I5 I6 } spilloffset: 24 typ: interface {}
- IN 3: R{ I7 I8 } spilloffset: 40 typ: interface { .f() untyped string }
+ IN 3: R{ I7 I8 } spilloffset: 40 typ: interface { F() string }
IN 4: R{ } offset: 0 typ: *interface {}
- IN 5: R{ } offset: 8 typ: interface { .f() untyped string }
+ IN 5: R{ } offset: 8 typ: interface { F() string }
IN 6: R{ } offset: 24 typ: int16
OUT 0: R{ I0 I1 } spilloffset: -1 typ: interface {}
- OUT 1: R{ I2 I3 } spilloffset: -1 typ: interface { .f() untyped string }
+ OUT 1: R{ I2 I3 } spilloffset: -1 typ: interface { F() string }
OUT 2: R{ I4 } spilloffset: -1 typ: *interface {}
offsetToSpillArea: 32 spillAreaSize: 56
`)