diff options
author | Dan Scales <danscales@google.com> | 2021-08-07 22:26:46 -0700 |
---|---|---|
committer | Dan Scales <danscales@google.com> | 2021-08-09 20:08:06 +0000 |
commit | f5f79c47f900300e8ac962e73ae7c2c706489d67 (patch) | |
tree | d230a1539fcfb224956b4b9dc17b6f94171cef87 /src/cmd/link/internal/ld/deadcode.go | |
parent | 9f4d6a83594a04f0fc82c33f373b7e7bcf64f7f2 (diff) | |
download | go-f5f79c47f900300e8ac962e73ae7c2c706489d67.tar.gz go-f5f79c47f900300e8ac962e73ae7c2c706489d67.zip |
[dev.typeparams] cmd/compile: use types2.Constraint() rather than types2.Bound()
types2.Constraint() returns the top-level constraint type, including any
unions or other interface elements. Because of that, we needed to
add/fix some code in the type substituter and generic type instantiater
in the importer to deal with unions and non-method members of an
interface. Also, NewUnion was not correctly setting the HasTParam flag.
I also added a better error message when a symbol is not found in
(*deadcodePass).decodeIfaceMethod().
Change-Id: Id3668dc596dce63690fa05a9e5e42295b5e2bbb5
Reviewed-on: https://go-review.googlesource.com/c/go/+/340670
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/link/internal/ld/deadcode.go')
-rw-r--r-- | src/cmd/link/internal/ld/deadcode.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cmd/link/internal/ld/deadcode.go b/src/cmd/link/internal/ld/deadcode.go index 416e5da398..dd5dafc21b 100644 --- a/src/cmd/link/internal/ld/deadcode.go +++ b/src/cmd/link/internal/ld/deadcode.go @@ -408,6 +408,9 @@ func (d *deadcodePass) decodeMethodSig(ldr *loader.Loader, arch *sys.Arch, symId // Decode the method of interface type symbol symIdx at offset off. func (d *deadcodePass) decodeIfaceMethod(ldr *loader.Loader, arch *sys.Arch, symIdx loader.Sym, off int64) methodsig { p := ldr.Data(symIdx) + if p == nil { + panic(fmt.Sprintf("missing symbol %q", ldr.SymName(symIdx))) + } if decodetypeKind(arch, p)&kindMask != kindInterface { panic(fmt.Sprintf("symbol %q is not an interface", ldr.SymName(symIdx))) } |