[dev.typeparams] cmd/compile: fix bunch of -G=3 bugs for test cases in test/typeparams/mdempsky

1.go, 12.go: similar to calculating type sizes, we delay computing
instantiations during import until we get up to a top-level type, in
order to make sure recursive types are complete. But we should always
delay calculating sizes when we delay instantiating types, since
otherwise we may try to calculate the size of an incomplete type. So,
needed to add Defer/ResumeCheckSize in (*importReader).typ where we also
defer instantiations. (iimport.go)

2.go: when doing type substition, we have to handle named, parameterized
basic types i.e. the type has a type parameter even though the
underlying type is a basic type that doesn't depend on the parameter.
(subr.go)

3.go: for go 1.18, we allow arbitrary types in interfaces. We had
already allowed union types and tilde types, but didn't allow regular
non-interface types in Go 1.17 for compatibility.  Just skip an error
in the case of 1.18. (size.go)

5.go: types2 and types1 differ in how they print out interfaces. types1
puts a space between "interface" and "{", types2 does not. So, since
some typenames come from types2 and some from types1, we need to remove
the space when printing out type arguments. (iimport.go/subr.go)

9.go: in subst.node(), we were missing the KeyExpr case where a node has
no type. The assertion is just there, to make sure we understand all the
cases where there is no type to translate. We could just remove the
whole error check. (stencil.go)

13.go: in subst.node(), missed handling the case where a method
expression is immediate called (which of course, is quite unusual, since
then there's no real reason to have used the method expression syntax in
that case). Just needed to add ir.OMETHEXPR in the OCALL switch
statement.  (stencil.go)

Change-Id: I202cbe9541dfafe740e3b84b44982d6181738ea0
Reviewed-on: https://go-review.googlesource.com/c/go/+/333165
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 files changed
tree: fc6d7f663f5cd6730d2fb106063486c749c5e95e
  1. .github/
  2. api/
  3. doc/
  4. lib/
  5. misc/
  6. src/
  7. test/
  8. .gitattributes
  9. .gitignore
  10. AUTHORS
  11. codereview.cfg
  12. CONTRIBUTING.md
  13. CONTRIBUTORS
  14. LICENSE
  15. PATENTS
  16. README.md
  17. SECURITY.md
README.md

The Go Programming Language

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

Gopher image Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.

Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.

Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.

Download and Install

Binary Distributions

Official binary distributions are available at https://golang.org/dl/.

After downloading a binary release, visit https://golang.org/doc/install for installation instructions.

Install From Source

If a binary distribution is not available for your combination of operating system and architecture, visit https://golang.org/doc/install/source for source installation instructions.

Contributing

Go is the work of thousands of contributors. We appreciate your help!

To contribute, please read the contribution guidelines at https://golang.org/doc/contribute.html.

Note that the Go project uses the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.