]> Cypherpunks.ru repositories - gostls13.git/commitdiff
[dev.typeparams] all: merge dev.regabi (77365c5) into dev.typeparams
authorMatthew Dempsky <mdempsky@google.com>
Tue, 5 Jan 2021 18:10:56 +0000 (10:10 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 5 Jan 2021 18:13:59 +0000 (10:13 -0800)
Conflicts:

- src/cmd/compile/internal/gc/main.go
- test/fixedbugs/issue15055.go

Merge List:

+ 2021-01-05 77365c5ed7 [dev.regabi] cmd/compile: add Name.Canonical and move Byval
+ 2021-01-05 e09783cbc0 [dev.regabi] cmd/compile: make ir.StaticValue safer
+ 2021-01-05 9aa950c407 [dev.regabi] cmd/compile: make ir.OuterValue safer
+ 2021-01-05 eb626409d1 [dev.regabi] cmd/compile: simplify CaptureVars
+ 2021-01-05 c28ca67a96 [dev.regabi] cmd/compile: fix ir.Dump for []*CaseClause, etc
+ 2021-01-04 f24e40c14a [dev.regabi] cmd/compile: remove Name.Class_ accessors
+ 2021-01-04 d89705e087 [dev.regabi] cmd/compile: fix re-export of parameters
+ 2021-01-04 290b4154b7 [dev.regabi] cmd/compile: fix ICE due to large uint64 constants
+ 2021-01-04 a30fd52884 [dev.regabi] cmd/compile: use ir.NewNameAt in SubstArgTypes
+ 2021-01-03 8fc44cf0fa [dev.regabi] cmd/compile: remove a couple CloneName calls
+ 2021-01-03 907a4bfdc7 [dev.regabi] cmd/compile: fix map assignment order
+ 2021-01-03 f2e6dab048 [dev.regabi] cmd/compile: remove walkReturn "common case" path
+ 2021-01-03 d36a6bf44d [dev.regabi] cmd/compile: improve walkReturn common case
+ 2021-01-03 a317067d65 [dev.regabi] cmd/compile: improve ascompatee
+ 2021-01-03 5d80a590a2 [dev.regabi] cmd/compile: simplify walkReturn
+ 2021-01-03 bb1b6c95c2 [dev.regabi] cmd/compile: remove Node.{,Set}Walkdef
+ 2021-01-03 57c426c9a5 [dev.regabi] cmd/compile: tighten typecheckdef to *ir.Name
+ 2021-01-03 b1747756e3 [dev.regabi] cmd/compile: reorganize escape analysis somewhat
+ 2021-01-02 f2538033c0 [dev.regabi] cmd/compile: remove Nodes.Set [generated]
+ 2021-01-02 2f2d4b4e68 [dev.regabi] cmd/compile: remove {Ptr,Set}Init from Node interface
+ 2021-01-01 1544a03198 [dev.regabi] cmd/compile: refactor redundant type conversion [generated]
+ 2021-01-01 7958a23ea3 [dev.regabi] cmd/compile: use *ir.Name where possible in inl.go
+ 2021-01-01 bfa97ba48f [dev.regabi] test: add another closure test case
+ 2021-01-01 67ad695416 [dev.regabi] cmd/compile: split escape analysis state
+ 2021-01-01 fad9a8b528 [dev.regabi] cmd/compile: simplify inlining of closures
+ 2021-01-01 7d55669847 [dev.regabi] cmd/compile: simplify dwarfgen.declPos
+ 2021-01-01 9ed1577779 [dev.regabi] cmd/compile: remove Func.ClosureEnter
+ 2021-01-01 ece345aa69 [dev.regabi] cmd/compile: expand documentation for Func.Closure{Vars,Enter}
+ 2021-01-01 6ddbc75efd [dev.regabi] cmd/compile: earlier deadcode removal
+ 2021-01-01 68e6fa4f68 [dev.regabi] cmd/compile: fix package-initialization order
+ 2021-01-01 3a4474cdfd [dev.regabi] cmd/compile: some more manual shuffling
+ 2021-01-01 0f1d2129c4 [dev.regabi] cmd/compile: reshuffle type-checking code [generated]
+ 2021-01-01 b8fd3440cd [dev.regabi] cmd/compile: report unused variables during typecheck
+ 2021-01-01 fd22df9905 [dev.regabi] cmd/compile: remove idempotent Name() calls [generated]
+ 2020-12-31 dfbcff80c6 [dev.regabi] cmd/compile: make copyExpr return *ir.Name directly
+ 2020-12-31 77fd81a3e6 [dev.regabi] cmd/compile: use names for keep alive variables in function call
+ 2020-12-31 8fe1197654 [dev.regabi] cmd/compile: remove Name.orig
+ 2020-12-31 477b049060 [dev.regabi] cmd/compile: fix printing of method expressions
+ 2020-12-30 178c667db2 [dev.regabi] cmd/compile: fix OSLICEARR comments
+ 2020-12-30 f0d99def5b [dev.regabi] cmd/compile: add newline to ir.Dump
+ 2020-12-30 451693af71 [dev.regabi] cmd/compile: simplify typecheckdef
+ 2020-12-30 0c1a899a6c [dev.regabi] cmd/compile: fix defined-pointer method call check
+ 2020-12-30 f9b67f76a5 [dev.regabi] cmd/compile: change ir.DoChildren to use bool result type
+ 2020-12-30 499851bac8 [dev.regabi] cmd/compile: generalize ir/mknode.go
+ 2020-12-30 82ab3d1448 [dev.regabi] cmd/compile: use *ir.Name for Decl.X
+ 2020-12-30 9958b7ed3e [dev.regabi] cmd/compile: unexport ir.FmtNode
+ 2020-12-29 f5816624cd [dev.regabi] cmd/compile: change AddrExpr.Alloc to AddrExpr.Prealloc
+ 2020-12-29 850aa7c60c [dev.regabi] cmd/compile: use *ir.Name instead of ir.Node for CaseClause.Var
+ 2020-12-29 37babc97bb [dev.regabi] cmd/compile: allow visitor visits *ir.Name
+ 2020-12-29 5cf3c87fa6 [dev.regabi] cmd/compile: generate case/comm clause functions in mknode.go
+ 2020-12-29 b3e1ec97fd [dev.regabi] cmd/compile: move new addrtaken bit back to the old name
+ 2020-12-29 0620c674dd [dev.regabi] cmd/compile: remove original addrtaken bit
+ 2020-12-29 0523d525ae [dev.regabi] cmd/compile: separate out address taken computation from typechecker
+ 2020-12-29 9ea272e5ec [dev.regabi] cmd/compile: simplify ir.Func somewhat
+ 2020-12-29 e40cb4d4ae [dev.regabi] cmd/compile: remove more unused code
+ 2020-12-29 6f30c95048 [dev.regabi] cmd/compile: remove unneeded indirection
+ 2020-12-29 171fc6f223 [dev.regabi] cmd/compile: remove workarounds for go/constant issues
+ 2020-12-29 33801cdc62 [dev.regabi] cmd/compile: use Ntype where possible
+ 2020-12-29 82ad3083f8 [dev.regabi] cmd/compile: remove typ from AssignOpStmt
+ 2020-12-29 e34c44a7c4 [dev.regabi] cmd/compile: refactoring typecheck arith
+ 2020-12-29 a5ec920160 [dev.regabi] cmd/compile: more Linksym cleanup
+ 2020-12-29 ec59b197d5 [dev.regabi] cmd/compile: rewrite to use linksym helpers [generated]
+ 2020-12-29 25c613c02d [dev.regabi] cmd/compile: add Linksym helpers
+ 2020-12-29 289da2b33e [dev.regabi] cmd/compile: move Node.Opt to Name
+ 2020-12-29 6acbae4fcc [dev.regabi] cmd/compile: address some ir TODOs
+ 2020-12-29 4629f6a51d [dev.regabi] cmd/compile: merge {Selector,CallPart,Method}Expr
+ 2020-12-29 e563715b30 [dev.regabi] cmd/compile: remove Sym.Importdef
+ 2020-12-29 3f370b75fb [dev.regabi] cmd/compile: cleanup //go:generate directives

Change-Id: Ibb254630924ac5873ebda6762ceb066f54a82649

1  2 
src/cmd/compile/internal/noder/noder.go
test/fixedbugs/issue15055.go

index c1356be52f4285f01ba4419bb329a3164c61c880,76913c62a6dfd94545d21b5eb045fb7b93a218ea..938ffe05ce1a57c3a0e4832c0d29c411164dc5e4
@@@ -28,6 -25,20 +28,26 @@@ import 
        "cmd/internal/src"
  )
  
+ func LoadPackage(filenames []string) {
+       base.Timer.Start("fe", "parse")
+       lines := ParseFiles(filenames)
+       base.Timer.Stop()
+       base.Timer.AddEvent(int64(lines), "lines")
++      if base.Flag.G != 0 && base.Flag.G < 3 {
++              // can only parse generic code for now
++              base.ExitIfErrors()
++              return
++      }
++
+       // Typecheck.
+       Package()
+       // With all user code typechecked, it's now safe to verify unused dot imports.
+       CheckDotImports()
+       base.ExitIfErrors()
+ }
  // ParseFiles concurrently parses files into *syntax.File structures.
  // Each declaration in every *syntax.File is converted to a syntax tree
  // and its root represented by *Node is appended to Target.Decls.
@@@ -167,26 -95,73 +187,89 @@@ func ParseFiles(filenames []string) (li
        }
  
        types.LocalPkg.Height = myheight
 -
 -      return lines
 +      return
  }
  
+ func Package() {
+       typecheck.DeclareUniverse()
+       typecheck.TypecheckAllowed = true
+       // Process top-level declarations in phases.
+       // Phase 1: const, type, and names and types of funcs.
+       //   This will gather all the information about types
+       //   and methods but doesn't depend on any of it.
+       //
+       //   We also defer type alias declarations until phase 2
+       //   to avoid cycles like #18640.
+       //   TODO(gri) Remove this again once we have a fix for #25838.
+       // Don't use range--typecheck can add closures to Target.Decls.
+       base.Timer.Start("fe", "typecheck", "top1")
+       for i := 0; i < len(typecheck.Target.Decls); i++ {
+               n := typecheck.Target.Decls[i]
+               if op := n.Op(); op != ir.ODCL && op != ir.OAS && op != ir.OAS2 && (op != ir.ODCLTYPE || !n.(*ir.Decl).X.Alias()) {
+                       typecheck.Target.Decls[i] = typecheck.Stmt(n)
+               }
+       }
+       // Phase 2: Variable assignments.
+       //   To check interface assignments, depends on phase 1.
+       // Don't use range--typecheck can add closures to Target.Decls.
+       base.Timer.Start("fe", "typecheck", "top2")
+       for i := 0; i < len(typecheck.Target.Decls); i++ {
+               n := typecheck.Target.Decls[i]
+               if op := n.Op(); op == ir.ODCL || op == ir.OAS || op == ir.OAS2 || op == ir.ODCLTYPE && n.(*ir.Decl).X.Alias() {
+                       typecheck.Target.Decls[i] = typecheck.Stmt(n)
+               }
+       }
+       // Phase 3: Type check function bodies.
+       // Don't use range--typecheck can add closures to Target.Decls.
+       base.Timer.Start("fe", "typecheck", "func")
+       var fcount int64
+       for i := 0; i < len(typecheck.Target.Decls); i++ {
+               n := typecheck.Target.Decls[i]
+               if n.Op() == ir.ODCLFUNC {
+                       typecheck.FuncBody(n.(*ir.Func))
+                       fcount++
+               }
+       }
+       // Phase 4: Check external declarations.
+       // TODO(mdempsky): This should be handled when type checking their
+       // corresponding ODCL nodes.
+       base.Timer.Start("fe", "typecheck", "externdcls")
+       for i, n := range typecheck.Target.Externs {
+               if n.Op() == ir.ONAME {
+                       typecheck.Target.Externs[i] = typecheck.Expr(typecheck.Target.Externs[i])
+               }
+       }
+       // Phase 5: With all user code type-checked, it's now safe to verify map keys.
+       typecheck.CheckMapKeys()
+ }
 +// Temporary import helper to get type2-based type-checking going.
 +type gcimports struct {
 +      packages map[string]*types2.Package
 +      lookup   func(path string) (io.ReadCloser, error)
 +}
 +
 +func (m *gcimports) Import(path string) (*types2.Package, error) {
 +      return m.ImportFrom(path, "" /* no vendoring */, 0)
 +}
 +
 +func (m *gcimports) ImportFrom(path, srcDir string, mode types2.ImportMode) (*types2.Package, error) {
 +      if mode != 0 {
 +              panic("mode must be 0")
 +      }
 +      return importer.Import(m.packages, path, srcDir, m.lookup)
 +}
 +
  // makeSrcPosBase translates from a *syntax.PosBase to a *src.PosBase.
  func (p *noder) makeSrcPosBase(b0 *syntax.PosBase) *src.PosBase {
        // fast path: most likely PosBase hasn't changed
index b6c3d96da6ecf48b09a44c743c0a041648695225,33cf63aaad8d1eb1a4543de5bf2ce148732c5cbe..81758d141c8305370e3c99863a52d052a319298d
@@@ -8,10 -8,12 +8,12 @@@ package mai
  
  func main() {
        type name string
 -      _ = []byte("abc", "def", 12)    // ERROR "too many arguments to conversion to \[\]byte: \[\]byte\(.abc., .def., 12\)"
 -      _ = string("a", "b", nil)       // ERROR "too many arguments to conversion to string: string\(.a., .b., nil\)"
 -      _ = []byte()                    // ERROR "missing argument to conversion to \[\]byte: \[\]byte\(\)"
 -      _ = string()                    // ERROR "missing argument to conversion to string: string\(\)"
 -      _ = *int()                      // ERROR "missing argument to conversion to int: int\(\)"
 -      _ = (*int)()                    // ERROR "missing argument to conversion to \*int: \(\*int\)\(\)"
 -      _ = name("a", 1, 3.3)           // ERROR "too many arguments to conversion to name: name\(.a., 1, 3.3\)"
 -      _ = map[string]string(nil, nil) // ERROR "too many arguments to conversion to map\[string\]string: map\[string\]string\(nil, nil\)"
 +      _ = []byte("abc", "def", 12)    // ERROR "too many arguments (to conversion to \[\]byte: \(\[\]byte\)\(.abc., .def., 12\))?"
 +      _ = string("a", "b", nil)       // ERROR "too many arguments (to conversion to string: string\(.a., .b., nil\))?"
 +      _ = []byte()                    // ERROR "missing argument (to conversion to \[\]byte: \(\[\]byte\)\(\))?"
 +      _ = string()                    // ERROR "missing argument (to conversion to string: string\(\))?"
++      _ = *int()                      // ERROR "missing argument (to conversion to int: int\(\))?"
++      _ = (*int)()                    // ERROR "missing argument (to conversion to \*int: \(\*int\)\(\))?"
 +      _ = name("a", 1, 3.3)           // ERROR "too many arguments (to conversion to name: name\(.a., 1, 3.3\))?"
 +      _ = map[string]string(nil, nil) // ERROR "too many arguments (to conversion to map\[string\]string: \(map\[string\]string\)\(nil, nil\))?"
  }