]> Cypherpunks.ru repositories - gostls13.git/commitdiff
[dev.typeparams] all: merge dev.regabi (7e0a81d) into dev.typeparams
authorMatthew Dempsky <mdempsky@google.com>
Fri, 22 Jan 2021 23:35:11 +0000 (15:35 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Sat, 23 Jan 2021 00:32:37 +0000 (16:32 -0800)
As with CL 285875, this required resolving some conflicts around
handling of //go:embed directives. Still further work is needed to
reject uses of //go:embed in files that don't import "embed", so this
is left as a TODO. (When this code was written for dev.typeparams, we
were still leaning towards not requiring the "embed" import.)

Also, the recent support for inlining closures (CL 283112) interacts
poorly with -G=3 mode. There are some known issues with this code
already (#43818), so for now this CL disables inlining of closures
when in -G=3 mode with a TODO to revisit this once closure inlining is
working fully.

Conflicts:

- src/cmd/compile/internal/noder/noder.go
- src/cmd/compile/internal/typecheck/dcl.go
- src/cmd/compile/internal/typecheck/func.go
- test/run.go

Merge List:

+ 2021-01-22 7e0a81d280 [dev.regabi] all: merge master (dab3e5a) into dev.regabi
+ 2021-01-22 dab3e5affe runtime: switch runtime to libc for openbsd/amd64
+ 2021-01-22 a1b53d85da cmd/go: add documentation for test and xtest fields output by go list
+ 2021-01-22 b268b60774 runtime: remove pthread_kill/pthread_self for openbsd
+ 2021-01-22 ec4051763d runtime: fix typo in mgcscavenge.go
+ 2021-01-22 7ece3a7b17 net/http: fix flaky TestDisableKeepAliveUpgrade
+ 2021-01-22 50cba0506f time: clarify Timer.Reset behavior on AfterFunc Timers
+ 2021-01-22 cf10e69f17 doc/go1.16: mention net/http.Transport.GetProxyConnectHeader
+ 2021-01-22 ec1b945265 doc/go1.16: mention path/filepath.WalkDir
+ 2021-01-22 11def3d40b doc/go1.16: mention syscall.AllThreadsSyscall
+ 2021-01-21 07b0235609 doc/go1.16: add notes about package-specific fs.FS changes
+ 2021-01-21 e2b4f1fea5 doc/go1.16: minor formatting fix
+ 2021-01-21 9f43a9e07b doc/go1.16: mention new debug/elf constants
+ 2021-01-21 3c2f11ba5b cmd/go: overwrite program name with full path
+ 2021-01-21 953d1feca9 all: introduce and use internal/execabs
+ 2021-01-21 b186e4d70d cmd/go: add test case for cgo CC setting
+ 2021-01-21 5a8a2265fb cmd/cgo: report exec errors a bit more clearly
+ 2021-01-21 46e2e2e9d9 cmd/go: pass resolved CC, GCCGO to cgo
+ 2021-01-21 3d40895e36 runtime: switch openbsd/arm64 to pthreads
+ 2021-01-21 d95ca91380 crypto/elliptic: fix P-224 field reduction
+ 2021-01-21 d7e71c01ad [dev.regabi] cmd/compile: replace ir.Name map with ir.NameSet for dwarf
+ 2021-01-21 5248f59a22 [dev.regabi] cmd/compile: replace ir.Name map with ir.NameSet for SSA
+ 2021-01-21 970d8b6cb2 [dev.regabi] cmd/compile: replace ir.Name map with ir.NameSet in inlining
+ 2021-01-21 68a4664475 [dev.regabi] cmd/compile: remove tempAssigns in walkCall1
+ 2021-01-21 fd9a391cdd [dev.regabi] cmd/compile: remove CallExpr.Rargs
+ 2021-01-21 19a6db6b63 [dev.regabi] cmd/compile: make sure mkcall* passed non-nil init
+ 2021-01-21 9f036844db [dev.regabi] cmd/compile: use ir.DoChildren directly in inlining
+ 2021-01-21 213c3905e9 [dev.regabi] cmd/compile: use node walked flag to prevent double walk for walkSelect
+ 2021-01-20 1760d736f6 [dev.regabi] cmd/compile: exporting, importing, and inlining functions with OCLOSURE
+ 2021-01-20 ecf4ebf100 cmd/internal/moddeps: check content of all modules in GOROOT
+ 2021-01-20 92cb157cf3 [dev.regabi] cmd/compile: late expansion of return values
+ 2021-01-20 d2d155d1ae runtime: don't adjust timer pp field in timerWaiting status
+ 2021-01-20 803d18fc6c cmd/go: set Incomplete field on go list output if no files match embed
+ 2021-01-20 6e243ce71d cmd/go: have go mod vendor copy embedded files in subdirs
+ 2021-01-20 be28e5abc5 cmd/go: fix mod_get_fallback test
+ 2021-01-20 928bda4f4a runtime: convert openbsd/amd64 locking to libc
+ 2021-01-19 824f2d635c cmd/go: allow go fmt to complete when embedded file is missing
+ 2021-01-19 0575e35e50 cmd/compile: require 'go 1.16' go.mod line for //go:embed
+ 2021-01-19 9423d50d53 [dev.regabi] cmd/compile: use '%q' for printing rune values less than 128
+ 2021-01-19 ccb2e90688 cmd/link: exit before Asmb2 if error
+ 2021-01-19 ca5774a5a5 embed: treat uninitialized FS as empty
+ 2021-01-19 d047c91a6c cmd/link,runtime: switch openbsd/amd64 to pthreads
+ 2021-01-19 61debffd97 runtime: factor out usesLibcall
+ 2021-01-19 9fed39d281 runtime: factor out mStackIsSystemAllocated
+ 2021-01-19 a2f825c542 [dev.regabi] cmd/compile: directly create go.map and go.track symbols
+ 2021-01-19 4a4212c0e5 [dev.regabi] cmd/compile: refactor Linksym creation
+ 2021-01-19 4f5c603c0f [dev.regabi] cmd/compile: cleanup callTargetLSym
+ 2021-01-18 dbab079835 runtime: free Windows event handles after last lock is dropped
+ 2021-01-18 5a8fbb0d2d os: do not close syscall.Stdin in TestReadStdin
+ 2021-01-18 422f38fb6c [dev.regabi] cmd/compile: move stack objects to liveness
+ 2021-01-18 6113db0bb4 [dev.regabi] cmd/compile: convert OPANIC argument to interface{} during typecheck
+ 2021-01-18 4c835f9169 [dev.regabi] cmd/compile: use LinksymOffsetExpr in TypePtr/ItabAddr
+ 2021-01-18 0ffa1ead6e [dev.regabi] cmd/compile: use *obj.LSym instead of *ir.Name for staticdata functions
+ 2021-01-17 7e0fa38aad [dev.regabi] cmd/compile: remove unneeded packages from ir.Pkgs
+ 2021-01-17 99a5db11ac [dev.regabi] cmd/compile: use LinksymOffsetExpr in walkConvInterface
+ 2021-01-17 87845d14f9 [dev.regabi] cmd/compile: add ir.TailCallStmt
+ 2021-01-17 e3027c6828 [dev.regabi] cmd/compile: fix linux-amd64-noopt builder
+ 2021-01-17 59ff93fe64 [dev.regabi] cmd/compile: rename NameOffsetExpr to LinksymOffsetExpr
+ 2021-01-17 82b9cae700 [dev.regabi] cmd/compile: change ir.NameOffsetExpr to use *obj.LSym instead of *Name
+ 2021-01-17 88956fc4b1 [dev.regabi] cmd/compile: stop analyze NameOffsetExpr.Name_ in escape analysis
+ 2021-01-17 7ce2a8383d [dev.regabi] cmd/compile: simplify stack temp initialization
+ 2021-01-17 ba0e8a92fa [dev.regabi] cmd/compile: refactor temp construction in walk
+ 2021-01-17 78e5aabcdb [dev.regabi] cmd/compile: replace Node.HasCall with walk.mayCall
+ 2021-01-16 6de9423445 [dev.regabi] cmd/compile: cleanup OAS2FUNC ordering
+ 2021-01-16 a956a0e909 [dev.regabi] cmd/compile, runtime: fix up comments/error messages from recent renames
+ 2021-01-16 ab3b67abfd [dev.regabi] cmd/compile: remove ONEWOBJ
+ 2021-01-16 c9b1445ac8 [dev.regabi] cmd/compile: remove TypeAssertExpr {Src,Dst}Type fields
+ 2021-01-15 682a1d2176 runtime: detect errors in DuplicateHandle
+ 2021-01-15 9f83418b83 cmd/link: remove GOROOT write in TestBuildForTvOS
+ 2021-01-15 ec9470162f cmd/compile: allow embed into any string or byte slice type
+ 2021-01-15 54198b04db cmd/compile: disallow embed of var inside func
+ 2021-01-15 b386c735e7 cmd/go: fix go generate docs
+ 2021-01-15 bb5075a525 syscall: remove RtlGenRandom and move it into internal/syscall
+ 2021-01-15 1deae0b597 os: invoke processKiller synchronously in testKillProcess
+ 2021-01-15 03a875137f [dev.regabi] cmd/compile: unexport reflectdata.WriteType
+ 2021-01-15 14537e6e54 [dev.regabi] cmd/compile: move stkobj symbol generation to SSA
+ 2021-01-15 ab523fc510 [dev.regabi] cmd/compile: don't promote Byval CaptureVars if Addrtaken
+ 2021-01-15 ff196c3e84 crypto/x509: update iOS bundled roots to version 55188.40.9
+ 2021-01-15 b7a698c73f [dev.regabi] test: disable test on windows because expected contains path separators.
+ 2021-01-15 4be7af23f9 [dev.regabi] cmd/compile: fix ICE during ir.Dump
+ 2021-01-14 e125ccd10e cmd/go: in 'go mod edit', validate versions given to -retract and -exclude
+ 2021-01-14 eb330020dc cmd/dist, cmd/go: pass -arch for C compilation on Darwin
+ 2021-01-14 84e8a06f62 cmd/cgo: remove unnecessary space in cgo export header
+ 2021-01-14 0c86b999c3 cmd/test2json: document passing -test.paniconexit0
+ 2021-01-14 9135795891 cmd/go/internal/load: report positions for embed errors
+ 2021-01-14 35b9c66601 [dev.regabi] cmd/compile,cmd/link: additional code review suggestions for CL 270863
+ 2021-01-14 d9b79e53bb cmd/compile: fix wrong complement for arm64 floating-point comparisons
+ 2021-01-14 c73232d08f cmd/go/internal/load: refactor setErrorPos to PackageError.setPos
+ 2021-01-14 6aa28d3e06 go/build: report positions for go:embed directives
+ 2021-01-14 9734fd482d [dev.regabi] cmd/compile: use node walked flag to prevent double walk for walkSwitch
+ 2021-01-14 f97983249a [dev.regabi] cmd/compile: move more PAUTOHEAP to SSA construction
+ 2021-01-14 4476300425 [dev.regabi] cmd/compile: use byte for CallExpr.Use
+ 2021-01-14 5a5ab24689 [dev.regabi] cmd/compile: do not rely on CallExpr.Rargs for detect already walked calls
+ 2021-01-14 983ac4b086 [dev.regabi] cmd/compile: fix ICE when initializing blank vars
+ 2021-01-13 7eb31d999c cmd/go: add hints to more missing sum error messages
+ 2021-01-13 d6d4673728 [dev.regabi] cmd/compile: fix GOEXPERIMENT=regabi builder
+ 2021-01-13 c41b999ad4 [dev.regabi] cmd/compile: refactor abiutils from "gc" into new "abi"
+ 2021-01-13 861707a8c8 [dev.regabi] cmd/compile: added limited //go:registerparams pragma for new ABI dev
+ 2021-01-13 c1370e918f [dev.regabi] cmd/compile: add code to support register ABI spills around morestack calls
+ 2021-01-13 2abd24f3b7 [dev.regabi] test: make run.go error messages slightly more informative
+ 2021-01-13 9a19481acb [dev.regabi] cmd/compile: make ordering for InvertFlags more stable
+ 2021-01-12 ba76567bc2 cmd/go/internal/modload: delete unused *mvsReqs.next method
+ 2021-01-12 665def2c11 encoding/asn1: document unmarshaling behavior for IMPLICIT string fields
+ 2021-01-11 81ea89adf3 cmd/go: fix non-script staleness checks interacting badly with GOFLAGS
+ 2021-01-11 759309029f doc: update editors.html for Go 1.16
+ 2021-01-11 c3b4c7093a cmd/internal/objfile: don't require runtime.symtab symbol for XCOFF
+ 2021-01-08 59bfc18e34 cmd/go: add hint to read 'go help vcs' to GOVCS errors
+ 2021-01-08 cd6f3a54e4 cmd/go: revise 'go help' documentation for modules
+ 2021-01-08 6192b98751 cmd/go: make hints in error messages more consistent
+ 2021-01-08 25886cf4bd cmd/go: preserve sums for indirect deps fetched by 'go mod download'
+ 2021-01-08 6250833911 runtime/metrics: mark histogram metrics as cumulative
+ 2021-01-08 8f6a9acbb3 runtime/metrics: remove unused StopTheWorld Description field
+ 2021-01-08 6598c65646 cmd/compile: fix exponential-time init-cycle reporting
+ 2021-01-08 fefad1dc85 test: fix timeout code for invoking compiler
+ 2021-01-08 6728118e0a cmd/go: pass signals forward during "go tool"
+ 2021-01-08 e65c543f3c go/build/constraint: add parser for build tag constraint expressions
+ 2021-01-08 0c5afc4fb7 testing/fstest,os: clarify racy behavior of TestFS
+ 2021-01-08 32afcc9436 runtime/metrics: change unit on *-by-size metrics to match bucket unit
+ 2021-01-08 c6513bca5a io/fs: minor corrections to Glob doc
+ 2021-01-08 304f769ffc cmd/compile: don't short-circuit copies whose source is volatile
+ 2021-01-08 ae97717133 runtime,runtime/metrics: use explicit histogram boundaries
+ 2021-01-08 a9ccd2d795 go/build: skip string literal while findEmbed
+ 2021-01-08 d92f8add32 archive/tar: fix typo in comment
+ 2021-01-08 cab1202183 cmd/link: accept extra blocks in TestFallocate
+ 2021-01-08 ee4d32249b io/fs: minor corrections to Glob release date
+ 2021-01-08 54bd1ccce2 cmd: update to latest golang.org/x/tools
+ 2021-01-07 9ec21a8f34 Revert "reflect: support multiple keys in struct tags"
+ 2021-01-07 091414b5b7 io/fs: correct WalkDirFunc documentation
+ 2021-01-07 9b55088d6b doc/go1.16: add release note for disallowing non-ASCII import paths
+ 2021-01-07 fa90aaca7d cmd/compile: fix late expand_calls leaf type for OpStructSelect/OpArraySelect
+ 2021-01-07 7cee66d4cb cmd/go: add documentation for Embed fields in go list output
+ 2021-01-07 e60cffa4ca html/template: attach functions to namespace
+ 2021-01-07 6da2d3b7d7 cmd/link: fix typo in asm.go
+ 2021-01-07 df81a15819 runtime: check mips64 VDSO clock_gettime return code
+ 2021-01-06 4787e906cf crypto/x509: rollback new CertificateRequest fields
+ 2021-01-06 c9658bee93 cmd/go: make module suggestion more friendly
+ 2021-01-06 4c668b25c6 runtime/metrics: fix panic message for Float64Histogram
+ 2021-01-06 d2131704a6 net/http/httputil: fix deadlock in DumpRequestOut
+ 2021-01-05 3e1e13ce6d cmd/go: set cfg.BuildMod to "readonly" by default with no module root
+ 2021-01-05 0b0d004983 cmd/go: pass embedcfg to gccgo if supported
+ 2021-01-05 1b85e7c057 cmd/go: don't scan gccgo standard library packages for imports
+ 2021-01-05 6b37b15d95 runtime: don't take allglock in tracebackothers
+ 2021-01-04 9eef49cfa6 math/rand: fix typo in comment
+ 2021-01-04 b01fb2af9e testing/fstest: fix typo in error message
+ 2021-01-01 3dd5867605 doc: 2021 is the Year of the Gopher
+ 2020-12-31 95ce805d14 io/fs: remove darwin/arm64 special condition
+ 2020-12-30 20d0991b86 lib/time, time/tzdata: update tzdata to 2020f
+ 2020-12-30 ed301733bb misc/cgo/testcarchive: remove special flags for Darwin/ARM
+ 2020-12-30 0ae2e032f2 misc/cgo/test: enable TestCrossPackageTests on darwin/arm64
+ 2020-12-29 780b4de16b misc/ios: fix wording for command line instructions
+ 2020-12-29 b4a71c95d2 doc/go1.16: reference misc/ios/README for how to build iOS programs
+ 2020-12-29 f83e0f6616 misc/ios: add to README how to build ios executables
+ 2020-12-28 4fd9455882 io/fs: fix typo in comment

Change-Id: If24bb93f1e1e7deb1d92ba223c85940ab93b2732

16 files changed:
1  2 
src/cmd/compile/internal/base/flag.go
src/cmd/compile/internal/inline/inl.go
src/cmd/compile/internal/noder/decl.go
src/cmd/compile/internal/noder/import.go
src/cmd/compile/internal/noder/noder.go
src/cmd/compile/internal/reflectdata/reflect.go
src/cmd/compile/internal/typecheck/dcl.go
src/cmd/compile/internal/typecheck/func.go
src/cmd/compile/internal/typecheck/subr.go
src/cmd/compile/internal/typecheck/typecheck.go
src/cmd/compile/internal/types2/stdlib_test.go
src/cmd/compile/internal/walk/walk.go
src/cmd/internal/obj/link.go
src/reflect/all_test.go
test/fixedbugs/issue43762.go
test/run.go

Simple merge
index 6f5f6499ced51154c4530ba77048ff3a9a61aa61,83f6740a48d1dc96589b8ae89016a0bec622f62c..f0be169f561deb84513c46fe0eec7b4aebf27fe1
@@@ -351,10 -350,16 +350,23 @@@ func (v *hairyVisitor) doNode(n ir.Node
        case ir.ORECOVER:
                // recover matches the argument frame pointer to find
                // the right panic value, so it needs an argument frame.
-               return errors.New("call to recover")
+               v.reason = "call to recover"
+               return true
+       case ir.OCLOSURE:
++              // TODO(danscales,mdempsky): Get working with -G.
++              // Probably after #43818 is fixed.
++              if base.Flag.G > 0 {
++                      v.reason = "inlining closures not yet working with -G"
++                      return true
++              }
 +
-       case ir.OCLOSURE,
-               ir.ORANGE,
+               // TODO(danscales) - fix some bugs when budget is lowered below 30
+               // Maybe make budget proportional to number of closure variables, e.g.:
+               //v.budget -= int32(len(n.(*ir.ClosureExpr).Func.ClosureVars) * 3)
+               v.budget -= 30
+       case ir.ORANGE,
                ir.OSELECT,
                ir.OGO,
                ir.ODEFER,
index 4d20f410bc832f6c713c6569d3c189bd96b88c23,0000000000000000000000000000000000000000..c41b77c1008c138ab66ede48e0f171030addae7a
mode 100644,000000..100644
--- /dev/null
@@@ -1,226 -1,0 +1,228 @@@
-               if err := varEmbed(g.makeXPos, names[0], decl, pragma); err != nil {
-                       base.ErrorfAt(g.pos(decl), "%s", err.Error())
-               }
 +// Copyright 2021 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.
 +
 +package noder
 +
 +import (
 +      "cmd/compile/internal/base"
 +      "cmd/compile/internal/ir"
 +      "cmd/compile/internal/syntax"
 +      "cmd/compile/internal/typecheck"
 +      "cmd/compile/internal/types"
 +      "cmd/compile/internal/types2"
 +)
 +
 +// TODO(mdempsky): Skip blank declarations? Probably only safe
 +// for declarations without pragmas.
 +
 +func (g *irgen) decls(decls []syntax.Decl) []ir.Node {
 +      var res ir.Nodes
 +      for _, decl := range decls {
 +              switch decl := decl.(type) {
 +              case *syntax.ConstDecl:
 +                      g.constDecl(&res, decl)
 +              case *syntax.FuncDecl:
 +                      g.funcDecl(&res, decl)
 +              case *syntax.TypeDecl:
 +                      if ir.CurFunc == nil {
 +                              continue // already handled in irgen.generate
 +                      }
 +                      g.typeDecl(&res, decl)
 +              case *syntax.VarDecl:
 +                      g.varDecl(&res, decl)
 +              default:
 +                      g.unhandled("declaration", decl)
 +              }
 +      }
 +      return res
 +}
 +
 +func (g *irgen) importDecl(p *noder, decl *syntax.ImportDecl) {
 +      // TODO(mdempsky): Merge with gcimports so we don't have to import
 +      // packages twice.
 +
 +      g.pragmaFlags(decl.Pragma, 0)
 +
 +      ipkg := importfile(decl)
 +      if ipkg == ir.Pkgs.Unsafe {
 +              p.importedUnsafe = true
 +      }
++      if ipkg.Path == "embed" {
++              p.importedEmbed = true
++      }
 +}
 +
 +func (g *irgen) constDecl(out *ir.Nodes, decl *syntax.ConstDecl) {
 +      g.pragmaFlags(decl.Pragma, 0)
 +
 +      for _, name := range decl.NameList {
 +              name, obj := g.def(name)
 +              name.SetVal(obj.(*types2.Const).Val())
 +              out.Append(ir.NewDecl(g.pos(decl), ir.ODCLCONST, name))
 +      }
 +}
 +
 +func (g *irgen) funcDecl(out *ir.Nodes, decl *syntax.FuncDecl) {
 +      fn := ir.NewFunc(g.pos(decl))
 +      fn.Nname, _ = g.def(decl.Name)
 +      fn.Nname.Func = fn
 +      fn.Nname.Defn = fn
 +
 +      fn.Pragma = g.pragmaFlags(decl.Pragma, funcPragmas)
 +      if fn.Pragma&ir.Systemstack != 0 && fn.Pragma&ir.Nosplit != 0 {
 +              base.ErrorfAt(fn.Pos(), "go:nosplit and go:systemstack cannot be combined")
 +      }
 +
 +      if decl.Name.Value == "init" && decl.Recv == nil {
 +              g.target.Inits = append(g.target.Inits, fn)
 +      }
 +
 +      g.funcBody(fn, decl.Recv, decl.Type, decl.Body)
 +
 +      out.Append(fn)
 +}
 +
 +func (g *irgen) typeDecl(out *ir.Nodes, decl *syntax.TypeDecl) {
 +      if decl.Alias {
 +              if !types.AllowsGoVersion(types.LocalPkg, 1, 9) {
 +                      base.ErrorfAt(g.pos(decl), "type aliases only supported as of -lang=go1.9")
 +              }
 +
 +              name, _ := g.def(decl.Name)
 +              g.pragmaFlags(decl.Pragma, 0)
 +
 +              // TODO(mdempsky): This matches how typecheckdef marks aliases for
 +              // export, but this won't generalize to exporting function-scoped
 +              // type aliases. We should maybe just use n.Alias() instead.
 +              if ir.CurFunc == nil {
 +                      name.Sym().Def = ir.TypeNode(name.Type())
 +              }
 +
 +              out.Append(ir.NewDecl(g.pos(decl), ir.ODCLTYPE, name))
 +              return
 +      }
 +
 +      // Prevent size calculations until we set the underlying type.
 +      types.DeferCheckSize()
 +
 +      name, obj := g.def(decl.Name)
 +      ntyp, otyp := name.Type(), obj.Type()
 +      if ir.CurFunc != nil {
 +              typecheck.TypeGen++
 +              ntyp.Vargen = typecheck.TypeGen
 +      }
 +
 +      pragmas := g.pragmaFlags(decl.Pragma, typePragmas)
 +      name.SetPragma(pragmas) // TODO(mdempsky): Is this still needed?
 +
 +      if pragmas&ir.NotInHeap != 0 {
 +              ntyp.SetNotInHeap(true)
 +      }
 +
 +      // We need to use g.typeExpr(decl.Type) here to ensure that for
 +      // chained, defined-type declarations like
 +      //
 +      //      type T U
 +      //
 +      //      //go:notinheap
 +      //      type U struct { â€¦ }
 +      //
 +      // that we mark both T and U as NotInHeap. If we instead used just
 +      // g.typ(otyp.Underlying()), then we'd instead set T's underlying
 +      // type directly to the struct type (which is not marked NotInHeap)
 +      // and fail to mark T as NotInHeap.
 +      //
 +      // Also, we rely here on Type.SetUnderlying allowing passing a
 +      // defined type and handling forward references like from T to U
 +      // above. Contrast with go/types's Named.SetUnderlying, which
 +      // disallows this.
 +      //
 +      // [mdempsky: Subtleties like these are why I always vehemently
 +      // object to new type pragmas.]
 +      ntyp.SetUnderlying(g.typeExpr(decl.Type))
 +      types.ResumeCheckSize()
 +
 +      if otyp, ok := otyp.(*types2.Named); ok && otyp.NumMethods() != 0 {
 +              methods := make([]*types.Field, otyp.NumMethods())
 +              for i := range methods {
 +                      m := otyp.Method(i)
 +                      meth := g.obj(m)
 +                      methods[i] = types.NewField(meth.Pos(), g.selector(m), meth.Type())
 +                      methods[i].Nname = meth
 +              }
 +              ntyp.Methods().Set(methods)
 +      }
 +
 +      out.Append(ir.NewDecl(g.pos(decl), ir.ODCLTYPE, name))
 +}
 +
 +func (g *irgen) varDecl(out *ir.Nodes, decl *syntax.VarDecl) {
 +      pos := g.pos(decl)
 +      names := make([]*ir.Name, len(decl.NameList))
 +      for i, name := range decl.NameList {
 +              names[i], _ = g.def(name)
 +      }
 +      values := g.exprList(decl.Values)
 +
 +      if decl.Pragma != nil {
 +              pragma := decl.Pragma.(*pragmas)
++              // TODO(mdempsky): Plumb noder.importedEmbed through to here.
++              varEmbed(g.makeXPos, names[0], decl, pragma, true)
 +              g.reportUnused(pragma)
 +      }
 +
 +      var as2 *ir.AssignListStmt
 +      if len(values) != 0 && len(names) != len(values) {
 +              as2 = ir.NewAssignListStmt(pos, ir.OAS2, make([]ir.Node, len(names)), values)
 +      }
 +
 +      for i, name := range names {
 +              if ir.CurFunc != nil {
 +                      out.Append(ir.NewDecl(pos, ir.ODCL, name))
 +              }
 +              if as2 != nil {
 +                      as2.Lhs[i] = name
 +                      name.Defn = as2
 +              } else {
 +                      as := ir.NewAssignStmt(pos, name, nil)
 +                      if len(values) != 0 {
 +                              as.Y = values[i]
 +                              name.Defn = as
 +                      } else if ir.CurFunc == nil {
 +                              name.Defn = as
 +                      }
 +                      out.Append(typecheck.Stmt(as))
 +              }
 +      }
 +      if as2 != nil {
 +              out.Append(typecheck.Stmt(as2))
 +      }
 +}
 +
 +// pragmaFlags returns any specified pragma flags included in allowed,
 +// and reports errors about any other, unexpected pragmas.
 +func (g *irgen) pragmaFlags(pragma syntax.Pragma, allowed ir.PragmaFlag) ir.PragmaFlag {
 +      if pragma == nil {
 +              return 0
 +      }
 +      p := pragma.(*pragmas)
 +      present := p.Flag & allowed
 +      p.Flag &^= allowed
 +      g.reportUnused(p)
 +      return present
 +}
 +
 +// reportUnused reports errors about any unused pragmas.
 +func (g *irgen) reportUnused(pragma *pragmas) {
 +      for _, pos := range pragma.Pos {
 +              if pos.Flag&pragma.Flag != 0 {
 +                      base.ErrorfAt(g.makeXPos(pos.Pos), "misplaced compiler directive")
 +              }
 +      }
 +      if len(pragma.Embeds) > 0 {
 +              for _, e := range pragma.Embeds {
 +                      base.ErrorfAt(g.makeXPos(e.Pos), "misplaced go:embed directive")
 +              }
 +      }
 +}
index e1ae2569e0c97a149853b06cb506c117d94ca487,5bb01895cc9ea9a929bc0d14c9b444bb416289c1..887205b9fb0b9bcf1259368ecb05408c166961d8
@@@ -385,9 -465,20 +392,7 @@@ func (p *noder) varDecl(decl *syntax.Va
        exprs := p.exprList(decl.Values)
  
        if pragma, ok := decl.Pragma.(*pragmas); ok {
-               if err := varEmbed(p.makeXPos, names[0], decl, pragma); err != nil {
-                       p.errorAt(decl.Pos(), "%s", err.Error())
 -              if len(pragma.Embeds) > 0 {
 -                      if !p.importedEmbed {
 -                              // This check can't be done when building the list pragma.Embeds
 -                              // because that list is created before the noder starts walking over the file,
 -                              // so at that point it hasn't seen the imports.
 -                              // We're left to check now, just before applying the //go:embed lines.
 -                              for _, e := range pragma.Embeds {
 -                                      p.errorAt(e.Pos, "//go:embed only allowed in Go files that import \"embed\"")
 -                              }
 -                      } else {
 -                              varEmbed(p, names, typ, exprs, pragma.Embeds)
 -                      }
 -                      pragma.Embeds = nil
--              }
++              varEmbed(p.makeXPos, names[0], decl, pragma, p.importedEmbed)
                p.checkUnused(pragma)
        }
  
@@@ -1829,36 -1923,48 +1834,41 @@@ func oldname(s *types.Sym) ir.Node 
        return n
  }
  
- func varEmbed(makeXPos func(syntax.Pos) src.XPos, name *ir.Name, decl *syntax.VarDecl, pragma *pragmas) error {
 -func varEmbed(p *noder, names []*ir.Name, typ ir.Ntype, exprs []ir.Node, embeds []pragmaEmbed) {
 -      haveEmbed := false
 -      for _, decl := range p.file.DeclList {
 -              imp, ok := decl.(*syntax.ImportDecl)
 -              if !ok {
 -                      // imports always come first
 -                      break
 -              }
 -              path, _ := strconv.Unquote(imp.Path.Value)
 -              if path == "embed" {
 -                      haveEmbed = true
 -                      break
 -              }
++func varEmbed(makeXPos func(syntax.Pos) src.XPos, name *ir.Name, decl *syntax.VarDecl, pragma *pragmas, haveEmbed bool) {
 +      if pragma.Embeds == nil {
-               return nil
++              return
        }
  
 -      pos := embeds[0].Pos
 +      pragmaEmbeds := pragma.Embeds
 +      pragma.Embeds = nil
++      pos := makeXPos(pragmaEmbeds[0].Pos)
 +
-       if base.Flag.Cfg.Embed.Patterns == nil {
-               return errors.New("invalid go:embed: build system did not supply embed configuration")
+       if !haveEmbed {
 -              p.errorAt(pos, "invalid go:embed: missing import \"embed\"")
++              base.ErrorfAt(pos, "go:embed only allowed in Go files that import \"embed\"")
+               return
        }
 -      if len(names) > 1 {
 -              p.errorAt(pos, "go:embed cannot apply to multiple vars")
 +      if len(decl.NameList) > 1 {
-               return errors.New("go:embed cannot apply to multiple vars")
++              base.ErrorfAt(pos, "go:embed cannot apply to multiple vars")
+               return
        }
 -      if len(exprs) > 0 {
 -              p.errorAt(pos, "go:embed cannot apply to var with initializer")
 +      if decl.Values != nil {
-               return errors.New("go:embed cannot apply to var with initializer")
++              base.ErrorfAt(pos, "go:embed cannot apply to var with initializer")
+               return
        }
 -      if typ == nil {
 -              // Should not happen, since len(exprs) == 0 now.
 -              p.errorAt(pos, "go:embed cannot apply to var without type")
 +      if decl.Type == nil {
 +              // Should not happen, since Values == nil now.
-               return errors.New("go:embed cannot apply to var without type")
++              base.ErrorfAt(pos, "go:embed cannot apply to var without type")
+               return
        }
        if typecheck.DeclContext != ir.PEXTERN {
-               return errors.New("go:embed cannot apply to var inside func")
 -              p.errorAt(pos, "go:embed cannot apply to var inside func")
++              base.ErrorfAt(pos, "go:embed cannot apply to var inside func")
+               return
        }
  
 -      v := names[0]
 -      typecheck.Target.Embeds = append(typecheck.Target.Embeds, v)
 -      v.Embed = new([]ir.Embed)
 -      for _, e := range embeds {
 -              *v.Embed = append(*v.Embed, ir.Embed{Pos: p.makeXPos(e.Pos), Patterns: e.Patterns})
 +      var embeds []ir.Embed
 +      for _, e := range pragmaEmbeds {
 +              embeds = append(embeds, ir.Embed{Pos: makeXPos(e.Pos), Patterns: e.Patterns})
        }
-       return nil
 +      typecheck.Target.Embeds = append(typecheck.Target.Embeds, name)
 +      name.Embed = &embeds
  }
index 30857fff6da72d8564d8023e55cb7f8fea66a9b9,1ec92e3dd073e7ebd6ae4e2c9aca2d9710e9eefc..3ff14c87f4fc7b0603435b511771cc9cf1dcfbdc
@@@ -791,7 -791,7 +791,7 @@@ func dcommontype(lsym *obj.LSym, t *typ
  // TrackSym returns the symbol for tracking use of field/method f, assumed
  // to be a member of struct/interface type t.
  func TrackSym(t *types.Type, f *types.Field) *obj.LSym {
-       return ir.Pkgs.Track.Lookup(t.ShortString() + "." + f.Sym.Name).Linksym()
 -      return base.PkgLinksym("go.track", t.ShortString() + "." + f.Sym.Name, obj.ABI0)
++      return base.PkgLinksym("go.track", t.ShortString()+"."+f.Sym.Name, obj.ABI0)
  }
  
  func TypeSymPrefix(prefix string, t *types.Type) *types.Sym {
index bd54919c935d37be3fc11acbce2038b894ae1992,c324238bf1ef0f74258f80d90d00835d3634ddd4..eab0bb09b29500b6dd2198daa912b46f56845450
@@@ -309,9 -308,7 +309,9 @@@ func FakeRecv() *types.Field 
        return types.NewField(src.NoXPos, nil, types.FakeRecvType())
  }
  
- var funcStack []funcStackEnt // stack of previous values of Curfn/dclcontext
 +var fakeRecvField = FakeRecv
 +
+ var funcStack []funcStackEnt // stack of previous values of ir.CurFunc/DeclContext
  
  type funcStackEnt struct {
        curfn      *ir.Func
index 766eb8bae9155f94898aaa5fba08e43e82ab53e4,f624773c8f0fea62ab7aacdfa5d7f3e7aeb282f9..7ab5f68ce301b40a4f3325ff5d7e8a015cadd902
@@@ -303,8 -303,15 +303,15 @@@ func tcClosure(clo *ir.ClosureExpr, to
                return
        }
  
-       fn.Nname.SetSym(ClosureName(ir.CurFunc))
-       ir.MarkFunc(fn.Nname)
+       // Don't give a name and add to xtop if we are typechecking an inlined
+       // body in ImportedBody(), since we only want to create the named function
+       // when the closure is actually inlined (and then we force a typecheck
+       // explicitly in (*inlsubst).node()).
+       inTypeCheckInl := ir.CurFunc != nil && ir.CurFunc.Body == nil
+       if !inTypeCheckInl {
 -              fn.Nname.SetSym(closurename(ir.CurFunc))
++              fn.Nname.SetSym(ClosureName(ir.CurFunc))
+               ir.MarkFunc(fn.Nname)
+       }
        Func(fn)
        clo.SetType(fn.Type())
  
index ae573a4ec8129c547411899cfece95c05fa8e0e5,0000000000000000000000000000000000000000..ffd423be277aa6702978dc8d964b1fd937136b8c
mode 100644,000000..100644
--- /dev/null
@@@ -1,323 -1,0 +1,325 @@@
 +// 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.
 +
 +// This file tests types.Check by using it to
 +// typecheck the standard library and tests.
 +
 +package types2_test
 +
 +import (
 +      "bytes"
 +      "cmd/compile/internal/syntax"
 +      "fmt"
 +      "go/build"
 +      "internal/testenv"
 +      "io/ioutil"
 +      "os"
 +      "path/filepath"
 +      "runtime"
 +      "strings"
 +      "testing"
 +      "time"
 +
 +      . "cmd/compile/internal/types2"
 +)
 +
 +var stdLibImporter = defaultImporter()
 +
 +func TestStdlib(t *testing.T) {
 +      testenv.MustHaveGoBuild(t)
 +
 +      pkgCount := 0
 +      duration := walkPkgDirs(filepath.Join(runtime.GOROOT(), "src"), func(dir string, filenames []string) {
 +              typecheck(t, dir, filenames)
 +              pkgCount++
 +      }, t.Error)
 +
 +      if testing.Verbose() {
 +              fmt.Println(pkgCount, "packages typechecked in", duration)
 +      }
 +}
 +
 +// firstComment returns the contents of the first non-empty comment in
 +// the given file, "skip", or the empty string. No matter the present
 +// comments, if any of them contains a build tag, the result is always
 +// "skip". Only comments within the first 4K of the file are considered.
 +// TODO(gri) should only read until we see "package" token.
 +func firstComment(filename string) (first string) {
 +      f, err := os.Open(filename)
 +      if err != nil {
 +              return ""
 +      }
 +      defer f.Close()
 +
 +      // read at most 4KB
 +      var buf [4 << 10]byte
 +      n, _ := f.Read(buf[:])
 +      src := bytes.NewBuffer(buf[:n])
 +
 +      // TODO(gri) we need a better way to terminate CommentsDo
 +      defer func() {
 +              if p := recover(); p != nil {
 +                      if s, ok := p.(string); ok {
 +                              first = s
 +                      }
 +              }
 +      }()
 +
 +      syntax.CommentsDo(src, func(_, _ uint, text string) {
 +              if text[0] != '/' {
 +                      return // not a comment
 +              }
 +
 +              // extract comment text
 +              if text[1] == '*' {
 +                      text = text[:len(text)-2]
 +              }
 +              text = strings.TrimSpace(text[2:])
 +
 +              if strings.HasPrefix(text, "+build ") {
 +                      panic("skip")
 +              }
 +              if first == "" {
 +                      first = text // text may be "" but that's ok
 +              }
 +              // continue as we may still see build tags
 +      })
 +
 +      return
 +}
 +
 +func testTestDir(t *testing.T, path string, ignore ...string) {
 +      files, err := ioutil.ReadDir(path)
 +      if err != nil {
 +              t.Fatal(err)
 +      }
 +
 +      excluded := make(map[string]bool)
 +      for _, filename := range ignore {
 +              excluded[filename] = true
 +      }
 +
 +      for _, f := range files {
 +              // filter directory contents
 +              if f.IsDir() || !strings.HasSuffix(f.Name(), ".go") || excluded[f.Name()] {
 +                      continue
 +              }
 +
 +              // get per-file instructions
 +              expectErrors := false
 +              filename := filepath.Join(path, f.Name())
 +              if comment := firstComment(filename); comment != "" {
 +                      fields := strings.Fields(comment)
 +                      switch fields[0] {
 +                      case "skip", "compiledir":
 +                              continue // ignore this file
 +                      case "errorcheck":
 +                              expectErrors = true
 +                              for _, arg := range fields[1:] {
 +                                      if arg == "-0" || arg == "-+" || arg == "-std" {
 +                                              // Marked explicitly as not expected errors (-0),
 +                                              // or marked as compiling runtime/stdlib, which is only done
 +                                              // to trigger runtime/stdlib-only error output.
 +                                              // In both cases, the code should typecheck.
 +                                              expectErrors = false
 +                                              break
 +                                      }
 +                              }
 +                      }
 +              }
 +
 +              // parse and type-check file
 +              if testing.Verbose() {
 +                      fmt.Println("\t", filename)
 +              }
 +              file, err := syntax.ParseFile(filename, nil, nil, 0)
 +              if err == nil {
 +                      conf := Config{Importer: stdLibImporter}
 +                      _, err = conf.Check(filename, []*syntax.File{file}, nil)
 +              }
 +
 +              if expectErrors {
 +                      if err == nil {
 +                              t.Errorf("expected errors but found none in %s", filename)
 +                      }
 +              } else {
 +                      if err != nil {
 +                              t.Error(err)
 +                      }
 +              }
 +      }
 +}
 +
 +func TestStdTest(t *testing.T) {
 +      testenv.MustHaveGoBuild(t)
 +
 +      if testing.Short() && testenv.Builder() == "" {
 +              t.Skip("skipping in short mode")
 +      }
 +
 +      testTestDir(t, filepath.Join(runtime.GOROOT(), "test"),
 +              "cmplxdivide.go", // also needs file cmplxdivide1.go - ignore
 +              "directive.go",   // tests compiler rejection of bad directive placement - ignore
++              "embedfunc.go",   // tests //go:embed
++              "embedvers.go",   // tests //go:embed
 +              "linkname2.go",   // types2 doesn't check validity of //go:xxx directives
 +      )
 +}
 +
 +func TestStdFixed(t *testing.T) {
 +      testenv.MustHaveGoBuild(t)
 +
 +      if testing.Short() && testenv.Builder() == "" {
 +              t.Skip("skipping in short mode")
 +      }
 +
 +      testTestDir(t, filepath.Join(runtime.GOROOT(), "test", "fixedbugs"),
 +              "bug248.go", "bug302.go", "bug369.go", // complex test instructions - ignore
 +              "issue6889.go",   // gc-specific test
 +              "issue7746.go",   // large constants - consumes too much memory
 +              "issue11362.go",  // canonical import path check
 +              "issue16369.go",  // go/types handles this correctly - not an issue
 +              "issue18459.go",  // go/types doesn't check validity of //go:xxx directives
 +              "issue18882.go",  // go/types doesn't check validity of //go:xxx directives
 +              "issue20232.go",  // go/types handles larger constants than gc
 +              "issue20529.go",  // go/types does not have constraints on stack size
 +              "issue22200.go",  // go/types does not have constraints on stack size
 +              "issue22200b.go", // go/types does not have constraints on stack size
 +              "issue25507.go",  // go/types does not have constraints on stack size
 +              "issue20780.go",  // go/types does not have constraints on stack size
 +              "issue31747.go",  // go/types does not have constraints on language level (-lang=go1.12) (see #31793)
 +              "issue34329.go",  // go/types does not have constraints on language level (-lang=go1.13) (see #31793)
 +              "issue42058a.go", // go/types does not have constraints on channel element size
 +              "issue42058b.go", // go/types does not have constraints on channel element size
 +              "bug251.go",      // issue #34333 which was exposed with fix for #34151
 +      )
 +}
 +
 +func TestStdKen(t *testing.T) {
 +      testenv.MustHaveGoBuild(t)
 +
 +      testTestDir(t, filepath.Join(runtime.GOROOT(), "test", "ken"))
 +}
 +
 +// Package paths of excluded packages.
 +var excluded = map[string]bool{
 +      "builtin": true,
 +}
 +
 +// typecheck typechecks the given package files.
 +func typecheck(t *testing.T, path string, filenames []string) {
 +      // parse package files
 +      var files []*syntax.File
 +      for _, filename := range filenames {
 +              errh := func(err error) { t.Error(err) }
 +              file, err := syntax.ParseFile(filename, errh, nil, 0)
 +              if err != nil {
 +                      return
 +              }
 +
 +              if testing.Verbose() {
 +                      if len(files) == 0 {
 +                              fmt.Println("package", file.PkgName.Value)
 +                      }
 +                      fmt.Println("\t", filename)
 +              }
 +
 +              files = append(files, file)
 +      }
 +
 +      // typecheck package files
 +      conf := Config{
 +              Error:    func(err error) { t.Error(err) },
 +              Importer: stdLibImporter,
 +      }
 +      info := Info{Uses: make(map[*syntax.Name]Object)}
 +      conf.Check(path, files, &info)
 +
 +      // Perform checks of API invariants.
 +
 +      // All Objects have a package, except predeclared ones.
 +      errorError := Universe.Lookup("error").Type().Interface().ExplicitMethod(0) // (error).Error
 +      for id, obj := range info.Uses {
 +              predeclared := obj == Universe.Lookup(obj.Name()) || obj == errorError
 +              if predeclared == (obj.Pkg() != nil) {
 +                      posn := id.Pos()
 +                      if predeclared {
 +                              t.Errorf("%s: predeclared object with package: %s", posn, obj)
 +                      } else {
 +                              t.Errorf("%s: user-defined object without package: %s", posn, obj)
 +                      }
 +              }
 +      }
 +}
 +
 +// pkgFilenames returns the list of package filenames for the given directory.
 +func pkgFilenames(dir string) ([]string, error) {
 +      ctxt := build.Default
 +      ctxt.CgoEnabled = false
 +      pkg, err := ctxt.ImportDir(dir, 0)
 +      if err != nil {
 +              if _, nogo := err.(*build.NoGoError); nogo {
 +                      return nil, nil // no *.go files, not an error
 +              }
 +              return nil, err
 +      }
 +      if excluded[pkg.ImportPath] {
 +              return nil, nil
 +      }
 +      var filenames []string
 +      for _, name := range pkg.GoFiles {
 +              filenames = append(filenames, filepath.Join(pkg.Dir, name))
 +      }
 +      for _, name := range pkg.TestGoFiles {
 +              filenames = append(filenames, filepath.Join(pkg.Dir, name))
 +      }
 +      return filenames, nil
 +}
 +
 +func walkPkgDirs(dir string, pkgh func(dir string, filenames []string), errh func(args ...interface{})) time.Duration {
 +      w := walker{time.Now(), 10 * time.Millisecond, pkgh, errh}
 +      w.walk(dir)
 +      return time.Since(w.start)
 +}
 +
 +type walker struct {
 +      start time.Time
 +      dmax  time.Duration
 +      pkgh  func(dir string, filenames []string)
 +      errh  func(args ...interface{})
 +}
 +
 +func (w *walker) walk(dir string) {
 +      // limit run time for short tests
 +      if testing.Short() && time.Since(w.start) >= w.dmax {
 +              return
 +      }
 +
 +      fis, err := ioutil.ReadDir(dir)
 +      if err != nil {
 +              w.errh(err)
 +              return
 +      }
 +
 +      // apply pkgh to the files in directory dir
 +      // but ignore files directly under $GOROOT/src (might be temporary test files).
 +      if dir != filepath.Join(runtime.GOROOT(), "src") {
 +              files, err := pkgFilenames(dir)
 +              if err != nil {
 +                      w.errh(err)
 +                      return
 +              }
 +              if files != nil {
 +                      w.pkgh(dir, files)
 +              }
 +      }
 +
 +      // traverse subdirectories, but don't walk into testdata
 +      for _, fi := range fis {
 +              if fi.IsDir() && fi.Name() != "testdata" {
 +                      w.walk(filepath.Join(dir, fi.Name()))
 +              }
 +      }
 +}
index 4271772fb7bdd1eabedbb433f436e9baf505fb10,4273a62fe564ee25f0ab06d80a1d9dd17562a6a2..b47d96dc4c933db6022f9bffc20334b69313edba
@@@ -50,37 -49,8 +49,13 @@@ func Walk(fn *ir.Func) 
        if base.Flag.Cfg.Instrumenting {
                instrument(fn)
        }
 +
 +      // Eagerly compute sizes of all variables for SSA.
 +      for _, n := range fn.Dcl {
 +              types.CalcSize(n.Type())
 +      }
  }
  
- func paramoutheap(fn *ir.Func) bool {
-       for _, ln := range fn.Dcl {
-               switch ln.Class {
-               case ir.PPARAMOUT:
-                       if ir.IsParamStackCopy(ln) || ln.Addrtaken() {
-                               return true
-                       }
-               case ir.PAUTO:
-                       // stop early - parameters are over
-                       return false
-               }
-       }
-       return false
- }
  // walkRecv walks an ORECV node.
  func walkRecv(n *ir.UnaryExpr) ir.Node {
        if n.Typecheck() == 0 {
index 977c5c3303321ae17fce0ec0c90b6162bc4b9e0e,7ba8c6d317d1d67527b828704e0defd2a1ab34ba..35cb53cbf6cc83dcdccdc2a7df79e61d300929b0
@@@ -796,10 -807,11 +807,11 @@@ type Link struct 
        DebugInfo          func(fn *LSym, info *LSym, curfn interface{}) ([]dwarf.Scope, dwarf.InlCalls) // if non-nil, curfn is a *gc.Node
        GenAbstractFunc    func(fn *LSym)
        Errors             int
+       RegArgs            []RegArg
  
 -      InParallel      bool // parallel backend phase in effect
 -      UseBASEntries   bool // use Base Address Selection Entries in location lists and PC ranges
 -      IsAsm           bool // is the source assembly language, which may contain surprising idioms (e.g., call tables)
 +      InParallel    bool // parallel backend phase in effect
 +      UseBASEntries bool // use Base Address Selection Entries in location lists and PC ranges
 +      IsAsm         bool // is the source assembly language, which may contain surprising idioms (e.g., call tables)
  
        // state for writing objects
        Text []*LSym
Simple merge
index 0000000000000000000000000000000000000000,4544b6e4963d87c77b7f82eae80db0151eaf42be..9f7682ad6ac50b013a0e513b25bf55e9395a9c9b
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,11 +1,11 @@@
 -var _ = true == '\\' // ERROR "invalid operation: true == '\\\\'"
 -var _ = true == '\'' // ERROR "invalid operation: true == '\\''"
 -var _ = true == '\n' // ERROR "invalid operation: true == '\\n'"
+ // errorcheck
+ // Copyright 2021 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.
+ package p
++var _ = true == '\\' // ERROR "invalid operation: true == '\\\\'|cannot convert true"
++var _ = true == '\'' // ERROR "invalid operation: true == '\\''|cannot convert true"
++var _ = true == '\n' // ERROR "invalid operation: true == '\\n'|cannot convert true"
diff --cc test/run.go
index f2f17c4f2078236dccb2b523c7108a45ed260176,116f983a97a151562fc67392aea41e7c4e292356..a460c4d8b6ffe859735dbd3f2e5834fc30661465
@@@ -59,7 -59,7 +59,7 @@@ var 
  
        // dirs are the directories to look for *.go files in.
        // TODO(bradfitz): just use all directories?
-       dirs = []string{".", "ken", "chan", "interface", "syntax", "dwarf", "fixedbugs", "codegen", "runtime", "typeparam"}
 -      dirs = []string{".", "ken", "chan", "interface", "syntax", "dwarf", "fixedbugs", "codegen", "runtime", "abi"}
++      dirs = []string{".", "ken", "chan", "interface", "syntax", "dwarf", "fixedbugs", "codegen", "runtime", "abi", "typeparam"}
  
        // ratec controls the max number of tests running at a time.
        ratec chan bool
@@@ -1922,74 -1854,3 +1930,76 @@@ func overlayDir(dstRoot, srcRoot string
                return err
        })
  }
 +
 +// List of files that the compiler cannot errorcheck with the new typechecker (compiler -G option).
 +// Temporary scaffolding until we pass all the tests at which point this map can be removed.
 +var excluded = map[string]bool{
 +      "complit1.go":     true, // types2 reports extra errors
 +      "const2.go":       true, // types2 not run after syntax errors
 +      "ddd1.go":         true, // issue #42987
 +      "directive.go":    true, // misplaced compiler directive checks
++      "embedfunc.go":    true, // error reported by irgen (only runs with -G=3)
++      "embedvers.go":    true, // error reported by backend (only runs with -G=3)
 +      "float_lit3.go":   true, // types2 reports extra errors
 +      "import1.go":      true, // types2 reports extra errors
 +      "import5.go":      true, // issue #42988
 +      "import6.go":      true, // issue #43109
 +      "initializerr.go": true, // types2 reports extra errors
 +      "linkname2.go":    true, // error reported by noder (not running for types2 errorcheck test)
 +      "shift1.go":       true, // issue #42989
 +      "typecheck.go":    true, // invalid function is not causing errors when called
 +
 +      "fixedbugs/bug176.go":    true, // types2 reports all errors (pref: types2)
 +      "fixedbugs/bug193.go":    true, // types2 bug: shift error not reported (fixed in go/types)
 +      "fixedbugs/bug195.go":    true, // types2 reports slightly different (but correct) bugs
 +      "fixedbugs/bug228.go":    true, // types2 not run after syntax errors
 +      "fixedbugs/bug231.go":    true, // types2 bug? (same error reported twice)
 +      "fixedbugs/bug255.go":    true, // types2 reports extra errors
 +      "fixedbugs/bug351.go":    true, // types2 reports extra errors
 +      "fixedbugs/bug374.go":    true, // types2 reports extra errors
 +      "fixedbugs/bug385_32.go": true, // types2 doesn't produce "stack frame too large" error (32-bit specific)
 +      "fixedbugs/bug385_64.go": true, // types2 doesn't produce "stack frame too large" error
 +      "fixedbugs/bug388.go":    true, // types2 not run due to syntax errors
 +      "fixedbugs/bug412.go":    true, // types2 produces a follow-on error
 +
 +      "fixedbugs/issue11590.go":  true, // types2 doesn't report a follow-on error (pref: types2)
 +      "fixedbugs/issue11610.go":  true, // types2 not run after syntax errors
 +      "fixedbugs/issue11614.go":  true, // types2 reports an extra error
 +      "fixedbugs/issue13415.go":  true, // declared but not used conflict
 +      "fixedbugs/issue14520.go":  true, // missing import path error by types2
 +      "fixedbugs/issue14540.go":  true, // error reported by noder (not running for types2 errorcheck test)
 +      "fixedbugs/issue16428.go":  true, // types2 reports two instead of one error
 +      "fixedbugs/issue17038.go":  true, // types2 doesn't report a follow-on error (pref: types2)
 +      "fixedbugs/issue17645.go":  true, // multiple errors on same line
 +      "fixedbugs/issue18393.go":  true, // types2 not run after syntax errors
 +      "fixedbugs/issue19012.go":  true, // multiple errors on same line
 +      "fixedbugs/issue20233.go":  true, // types2 reports two instead of one error (pref: compiler)
 +      "fixedbugs/issue20245.go":  true, // types2 reports two instead of one error (pref: compiler)
 +      "fixedbugs/issue20529.go":  true, // types2 doesn't produce "stack frame too large" error
 +      "fixedbugs/issue20780.go":  true, // types2 doesn't produce "stack frame too large" error
 +      "fixedbugs/issue21979.go":  true, // types2 doesn't report a follow-on error (pref: types2)
 +      "fixedbugs/issue22200.go":  true, // types2 doesn't produce "stack frame too large" error
 +      "fixedbugs/issue22200b.go": true, // types2 doesn't produce "stack frame too large" error
 +      "fixedbugs/issue23732.go":  true, // types2 reports different (but ok) line numbers
 +      "fixedbugs/issue25507.go":  true, // types2 doesn't produce "stack frame too large" error
 +      "fixedbugs/issue25958.go":  true, // types2 doesn't report a follow-on error (pref: types2)
 +      "fixedbugs/issue28079b.go": true, // types2 reports follow-on errors
 +      "fixedbugs/issue28268.go":  true, // types2 reports follow-on errors
 +      "fixedbugs/issue31747.go":  true, // types2 is missing support for -lang flag
 +      "fixedbugs/issue33460.go":  true, // types2 reports alternative positions in separate error
 +      "fixedbugs/issue34329.go":  true, // types2 is missing support for -lang flag
 +      "fixedbugs/issue41575.go":  true, // types2 reports alternative positions in separate error
 +      "fixedbugs/issue42058a.go": true, // types2 doesn't report "channel element type too large"
 +      "fixedbugs/issue42058b.go": true, // types2 doesn't report "channel element type too large"
 +      "fixedbugs/issue4232.go":   true, // types2 reports (correct) extra errors
 +      "fixedbugs/issue4452.go":   true, // types2 reports (correct) extra errors
 +      "fixedbugs/issue5609.go":   true, // types2 needs a better error message
 +      "fixedbugs/issue6889.go":   true, // types2 can handle this without constant overflow
 +      "fixedbugs/issue7525.go":   true, // types2 reports init cycle error on different line - ok otherwise
 +      "fixedbugs/issue7525b.go":  true, // types2 reports init cycle error on different line - ok otherwise
 +      "fixedbugs/issue7525c.go":  true, // types2 reports init cycle error on different line - ok otherwise
 +      "fixedbugs/issue7525d.go":  true, // types2 reports init cycle error on different line - ok otherwise
 +      "fixedbugs/issue7525e.go":  true, // types2 reports init cycle error on different line - ok otherwise
 +      "fixedbugs/issue7742.go":   true, // types2 type-checking doesn't terminate
 +      "fixedbugs/issue7746.go":   true, // types2 type-checking doesn't terminate
 +}