diff options
author | Robert Griesemer <gri@golang.org> | 2021-08-05 18:14:28 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2021-08-06 20:34:53 +0000 |
commit | 9bd1817e417e9f07c6b3aba0189576bbf06f1592 (patch) | |
tree | 4fb0ff8c493d29d757f3889e6ec85609ffee2be9 /src/cmd/compile/internal/types2/interface.go | |
parent | 313924f2726947eb0df5f8fd0462c3a7343f5bc9 (diff) | |
download | go-9bd1817e417e9f07c6b3aba0189576bbf06f1592.tar.gz go-9bd1817e417e9f07c6b3aba0189576bbf06f1592.zip |
[dev.typeparams] cmd/compile/internal/types2: limit termlist lengths
At the moment, operations on termlists are O(n^2).
This is fine for normal-sized unions, but overlong
termlist lenghts will lead to excessive type checking
times.
Limit the length of termlists to avoid "compilations
that don't finish".
Change-Id: I39a7fc61b01c9db06faeb49a0e014b1ede532710
Reviewed-on: https://go-review.googlesource.com/c/go/+/340254
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/interface.go')
-rw-r--r-- | src/cmd/compile/internal/types2/interface.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/types2/interface.go b/src/cmd/compile/internal/types2/interface.go index f763f8ff44..89cf846598 100644 --- a/src/cmd/compile/internal/types2/interface.go +++ b/src/cmd/compile/internal/types2/interface.go @@ -140,7 +140,7 @@ func (check *Checker) interfaceType(ityp *Interface, iface *syntax.InterfaceType for _, f := range iface.MethodList { if f.Name == nil { // We have an embedded type; possibly a union of types. - addEmbedded(f.Type.Pos(), parseUnion(check, flattenUnion(nil, f.Type))) + addEmbedded(posFor(f.Type), parseUnion(check, flattenUnion(nil, f.Type))) continue } // f.Name != nil |