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/typeset_test.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/typeset_test.go')
-rw-r--r-- | src/cmd/compile/internal/types2/typeset_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/types2/typeset_test.go b/src/cmd/compile/internal/types2/typeset_test.go new file mode 100644 index 0000000000..0e14d523c8 --- /dev/null +++ b/src/cmd/compile/internal/types2/typeset_test.go @@ -0,0 +1,15 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package types2 + +import "testing" + +func TestInvalidTypeSet(t *testing.T) { + if !invalidTypeSet.IsEmpty() { + t.Error("invalidTypeSet is not empty") + } +} + +// TODO(gri) add more tests |