diff options
author | Robert Griesemer <gri@golang.org> | 2021-02-19 16:58:24 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2021-02-23 04:13:16 +0000 |
commit | 89eb2b55b9d128f0bd2bfada5d8b2bb115e1d6d8 (patch) | |
tree | 6ffb3c611026cc9800cbec30e0b033aaae4e0043 /src/cmd/compile/internal/types2/issues_test.go | |
parent | 378f73e2d56998fba872decd61583d96cd9b1f77 (diff) | |
download | go-89eb2b55b9d128f0bd2bfada5d8b2bb115e1d6d8.tar.gz go-89eb2b55b9d128f0bd2bfada5d8b2bb115e1d6d8.zip |
cmd/compile/internal/types2: review of issues_test.go
The changes between (equivalent, and reviewed) go/types/issues_test.go
and issues_test.go can be seen by comparing patchset 1 and 3. The actual
change is just removing the "// UNREVIEWED" marker and making making
some minor code adjustments to match go/types's version more closely.
Change-Id: I26f3f700d12db69fc68161a6b0dc081a0e9cd0d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/294473
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/issues_test.go')
-rw-r--r-- | src/cmd/compile/internal/types2/issues_test.go | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/cmd/compile/internal/types2/issues_test.go b/src/cmd/compile/internal/types2/issues_test.go index ba7cefb892..a36b832f04 100644 --- a/src/cmd/compile/internal/types2/issues_test.go +++ b/src/cmd/compile/internal/types2/issues_test.go @@ -1,4 +1,3 @@ -// UNREVIEWED // Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -29,7 +28,6 @@ func mustParse(t *testing.T, src string) *syntax.File { func TestIssue5770(t *testing.T) { f := mustParse(t, `package p; type S struct{T}`) var conf Config - // conf := Config{Importer: importer.Default()} _, err := conf.Check(f.PkgName.Value, []*syntax.File{f}, nil) // do not crash want := "undeclared name: T" if err == nil || !strings.Contains(err.Error(), want) { @@ -76,7 +74,7 @@ var ( } case *syntax.Name: if x.Value == "nil" { - want = NewInterfaceType(nil, nil) // interface{} + want = NewInterfaceType(nil, nil) // interface{} (for now, go/types types this as "untyped nil") } } if want != nil && !Identical(tv.Type, want) { @@ -387,9 +385,6 @@ func TestIssue28005(t *testing.T) { t.Fatal("object X not found") } iface := obj.Type().Underlying().(*Interface) // object X must be an interface - if iface == nil { - t.Fatalf("%s is not an interface", obj) - } // Each iface method m is embedded; and m's receiver base type name // must match the method's name per the choice in the source file. @@ -529,22 +524,22 @@ func TestIssue34921(t *testing.T) { func TestIssue43088(t *testing.T) { // type T1 struct { - // x T2 + // _ T2 // } // // type T2 struct { - // x struct { - // x T2 + // _ struct { + // _ T2 // } // } n1 := NewTypeName(syntax.Pos{}, nil, "T1", nil) T1 := NewNamed(n1, nil, nil) n2 := NewTypeName(syntax.Pos{}, nil, "T2", nil) T2 := NewNamed(n2, nil, nil) - s1 := NewStruct([]*Var{NewField(syntax.Pos{}, nil, "x", T2, false)}, nil) + s1 := NewStruct([]*Var{NewField(syntax.Pos{}, nil, "_", T2, false)}, nil) T1.SetUnderlying(s1) - s2 := NewStruct([]*Var{NewField(syntax.Pos{}, nil, "x", T2, false)}, nil) - s3 := NewStruct([]*Var{NewField(syntax.Pos{}, nil, "x", s2, false)}, nil) + s2 := NewStruct([]*Var{NewField(syntax.Pos{}, nil, "_", T2, false)}, nil) + s3 := NewStruct([]*Var{NewField(syntax.Pos{}, nil, "_", s2, false)}, nil) T2.SetUnderlying(s3) // These calls must terminate (no endless recursion). |