]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.typeparams] cmd/compile/internal/types2: review of hilbert_test.go
authorRobert Griesemer <gri@golang.org>
Tue, 27 Oct 2020 18:32:44 +0000 (11:32 -0700)
committerRobert Griesemer <gri@golang.org>
Tue, 27 Oct 2020 23:30:33 +0000 (23:30 +0000)
Primary differences:
1) syntax package is used instead of the go/* packages
2) parseSrc is a helper function that is used
   in place of parser.parseFile.
3) defaultImporter is a helper function providing
   access to an importer.

f=hilbert_test.go; diff $f ../../../../go/types/$f
5c5
< package types2_test
---
> package types_test
9d8
<  "cmd/compile/internal/syntax"
11a11,14
>  "go/ast"
>  "go/importer"
>  "go/parser"
>  "go/token"
15c18
<  . "cmd/compile/internal/types2"
---
>  . "go/types"
32,33c35,36
<  // TODO(gri) get rid of []bytes to string conversion below
<  f, err := parseSrc("hilbert.go", string(src))
---
>  fset := token.NewFileSet()
>  f, err := parser.ParseFile(fset, "hilbert.go", src, 0)
40,41c43,44
<  conf := Config{Importer: defaultImporter()}
<  _, err = conf.Check(f.PkgName.Value, []*syntax.File{f}, nil)
---
>  conf := Config{Importer: importer.Default()}
>  _, err = conf.Check(f.Name.Name, fset, []*ast.File{f}, nil)

Change-Id: I65851725a3b6ac35b87177f90b788c469a54a986
Reviewed-on: https://go-review.googlesource.com/c/go/+/265679
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/hilbert_test.go

index ee0c4daea65facec35816630c0426d496e23d553..9f9dad6b64ee04d04ca3b9a59b7f82ad044709c1 100644 (file)
@@ -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.