[dev.typeparams] cmd/compile/internal/importer, types2: initial check-in of types2 and importer

This is a copy of the importer and types2 (unreviewed) prototype version
excluding the testdata directory containing tests (see below). Each file
is marked with the comment

// UNREVIEWED

on the first line. The plan is to check in this code wholesale (it runs and
passes all tests) and then review the code file-by-file via subsequent CLs
and remove the "// UNREVIEWED" comments as we review the files.

Since most tests are unchanged from the original go/types, the next CL will
commit those tests as they don't need to be reviewed again. (Eventually we
may want to factor them out and share them from a single place, e.g. the
test directory.)

The existing file fmtmap_test.go was updated.

Change-Id: I9bd0ad1a7e7188b501423483a44d18e623c0fe71
Reviewed-on: https://go-review.googlesource.com/c/go/+/263624
Trust: Robert Griesemer <gri@golang.org>
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Robert Griesemer 2020-10-19 15:28:22 -07:00
parent 6ff16fe3ee
commit ca36ba83ab
90 changed files with 24300 additions and 3 deletions

View file

@ -42,6 +42,10 @@ var knownFormats = map[string]string{
"*cmd/compile/internal/ssa.Value %s": "",
"*cmd/compile/internal/ssa.Value %v": "",
"*cmd/compile/internal/ssa.sparseTreeMapEntry %v": "",
"*cmd/compile/internal/syntax.CallExpr %s": "",
"*cmd/compile/internal/syntax.CallExpr %v": "",
"*cmd/compile/internal/syntax.FuncLit %s": "",
"*cmd/compile/internal/syntax.IndexExpr %s": "",
"*cmd/compile/internal/types.Field %p": "",
"*cmd/compile/internal/types.Field %v": "",
"*cmd/compile/internal/types.Sym %0S": "",
@ -58,6 +62,25 @@ var knownFormats = map[string]string{
"*cmd/compile/internal/types.Type %p": "",
"*cmd/compile/internal/types.Type %s": "",
"*cmd/compile/internal/types.Type %v": "",
"*cmd/compile/internal/types2.Basic %s": "",
"*cmd/compile/internal/types2.Chan %s": "",
"*cmd/compile/internal/types2.Func %s": "",
"*cmd/compile/internal/types2.Initializer %s": "",
"*cmd/compile/internal/types2.Interface %s": "",
"*cmd/compile/internal/types2.MethodSet %s": "",
"*cmd/compile/internal/types2.Named %s": "",
"*cmd/compile/internal/types2.Named %v": "",
"*cmd/compile/internal/types2.Package %s": "",
"*cmd/compile/internal/types2.Package %v": "",
"*cmd/compile/internal/types2.Scope %p": "",
"*cmd/compile/internal/types2.Selection %s": "",
"*cmd/compile/internal/types2.Signature %s": "",
"*cmd/compile/internal/types2.TypeName %s": "",
"*cmd/compile/internal/types2.TypeName %v": "",
"*cmd/compile/internal/types2.TypeParam %s": "",
"*cmd/compile/internal/types2.Var %s": "",
"*cmd/compile/internal/types2.operand %s": "",
"*cmd/compile/internal/types2.substMap %s": "",
"*cmd/internal/obj.Addr %v": "",
"*cmd/internal/obj.LSym %v": "",
"*math/big.Float %f": "",
@ -67,6 +90,8 @@ var knownFormats = map[string]string{
"[16]byte %x": "",
"[]*cmd/compile/internal/ssa.Block %v": "",
"[]*cmd/compile/internal/ssa.Value %v": "",
"[]*cmd/compile/internal/types2.Func %v": "",
"[]*cmd/compile/internal/types2.TypeName %s": "",
"[][]string %q": "",
"[]byte %s": "",
"[]byte %x": "",
@ -75,6 +100,8 @@ var knownFormats = map[string]string{
"[]cmd/compile/internal/ssa.posetNode %v": "",
"[]cmd/compile/internal/ssa.posetUndo %v": "",
"[]cmd/compile/internal/syntax.token %s": "",
"[]cmd/compile/internal/types2.Type %s": "",
"[]int %v": "",
"[]string %v": "",
"[]uint32 %v": "",
"bool %v": "",
@ -100,6 +127,7 @@ var knownFormats = map[string]string{
"cmd/compile/internal/gc.fmtMode %d": "",
"cmd/compile/internal/gc.initKind %d": "",
"cmd/compile/internal/gc.itag %v": "",
"cmd/compile/internal/importer.itag %v": "",
"cmd/compile/internal/ssa.BranchPrediction %d": "",
"cmd/compile/internal/ssa.Edge %v": "",
"cmd/compile/internal/ssa.GCNode %v": "",
@ -122,9 +150,13 @@ var knownFormats = map[string]string{
"cmd/compile/internal/ssa.regMask %d": "",
"cmd/compile/internal/ssa.register %d": "",
"cmd/compile/internal/ssa.relation %s": "",
"cmd/compile/internal/syntax.ChanDir %d": "",
"cmd/compile/internal/syntax.Decl %T": "",
"cmd/compile/internal/syntax.Error %q": "",
"cmd/compile/internal/syntax.Error %v": "",
"cmd/compile/internal/syntax.Expr %#v": "",
"cmd/compile/internal/syntax.Expr %T": "",
"cmd/compile/internal/syntax.Expr %s": "",
"cmd/compile/internal/syntax.LitKind %d": "",
"cmd/compile/internal/syntax.Node %T": "",
"cmd/compile/internal/syntax.Operator %s": "",
@ -136,12 +168,22 @@ var knownFormats = map[string]string{
"cmd/compile/internal/types.EType %d": "",
"cmd/compile/internal/types.EType %s": "",
"cmd/compile/internal/types.EType %v": "",
"cmd/compile/internal/types2.Object %T": "",
"cmd/compile/internal/types2.Object %p": "",
"cmd/compile/internal/types2.Object %s": "",
"cmd/compile/internal/types2.Object %v": "",
"cmd/compile/internal/types2.Type %T": "",
"cmd/compile/internal/types2.Type %s": "",
"cmd/compile/internal/types2.Type %v": "",
"cmd/compile/internal/types2.color %s": "",
"cmd/internal/obj.ABI %v": "",
"error %s": "",
"error %v": "",
"float64 %.2f": "",
"float64 %.3f": "",
"float64 %.6g": "",
"float64 %g": "",
"go/constant.Value %s": "",
"int %#x": "",
"int %-12d": "",
"int %-6d": "",
@ -174,9 +216,10 @@ var knownFormats = map[string]string{
"interface{} %q": "",
"interface{} %s": "",
"interface{} %v": "",
"map[*cmd/compile/internal/gc.Node]*cmd/compile/internal/ssa.Value %v": "",
"map[*cmd/compile/internal/gc.Node][]*cmd/compile/internal/gc.Node %v": "",
"map[cmd/compile/internal/ssa.ID]uint32 %v": "",
"map[*cmd/compile/internal/gc.Node]*cmd/compile/internal/ssa.Value %v": "",
"map[*cmd/compile/internal/gc.Node][]*cmd/compile/internal/gc.Node %v": "",
"map[*cmd/compile/internal/types2.TypeParam]cmd/compile/internal/types2.Type %s": "",
"map[cmd/compile/internal/ssa.ID]uint32 %v": "",
"map[int64]uint32 %v": "",
"math/big.Accuracy %s": "",
"reflect.Type %s": "",
@ -186,6 +229,7 @@ var knownFormats = map[string]string{
"string %-*s": "",
"string %-16s": "",
"string %-6s": "",
"string %T": "",
"string %q": "",
"string %s": "",
"string %v": "",
@ -205,6 +249,7 @@ var knownFormats = map[string]string{
"uint64 %08x": "",
"uint64 %b": "",
"uint64 %d": "",
"uint64 %v": "",
"uint64 %x": "",
"uint8 %#x": "",
"uint8 %d": "",