]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.typeparams] cmd/compile/internal/types2: limit termlist lengths
authorRobert Griesemer <gri@golang.org>
Fri, 6 Aug 2021 01:14:28 +0000 (18:14 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 6 Aug 2021 20:34:53 +0000 (20:34 +0000)
commit9bd1817e417e9f07c6b3aba0189576bbf06f1592
tree4fb0ff8c493d29d757f3889e6ec85609ffee2be9
parent313924f2726947eb0df5f8fd0462c3a7343f5bc9
[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>
src/cmd/compile/internal/types2/interface.go
src/cmd/compile/internal/types2/testdata/check/unions.go2 [new file with mode: 0644]
src/cmd/compile/internal/types2/typeset.go
src/cmd/compile/internal/types2/typeset_test.go [new file with mode: 0644]
src/cmd/compile/internal/types2/union.go