]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.11] cmd/compile: reintroduce work-around for cyclic alias declara...
authorRobert Griesemer <gri@golang.org>
Sat, 3 Nov 2018 06:28:26 +0000 (23:28 -0700)
committerAndrew Bonventre <andybons@golang.org>
Mon, 26 Nov 2018 23:15:43 +0000 (23:15 +0000)
commit62b47c284c89fcda0646e033dd585e206b47465b
tree8e61a8cb32fcac0650f33b4682dde5205f0a2312
parent3e6c171e47e8c01afec79d9870625c3a9cee312c
[release-branch.go1.11] cmd/compile: reintroduce work-around for cyclic alias declarations

This change re-introduces (temporarily) a work-around for recursive
alias type declarations, originally in https://golang.org/cl/35831/
(intended as fix for #18640). The work-around was removed later
for a more comprehensive cycle detection check. That check
contained a subtle error which made the code appear to work,
while in fact creating incorrect types internally. See #25838
for details.

By re-introducing the original work-around, we eliminate problems
with many simple recursive type declarations involving aliases;
specifically cases such as #27232 and #27267. However, the more
general problem remains.

This CL also fixes the subtle error (incorrect variable use when
analyzing a type cycle) mentioned above and now issues a fatal
error with a reference to the relevant issue (rather than crashing
later during the compilation). While not great, this is better
than the current status. The long-term solution will need to
address these cycles (see #25838).

As a consequence, several old test cases are not accepted anymore
by the compiler since they happened to work accidentally only.
This CL disables parts or all code of those test cases. The issues
are: #18640, #23823, and #24939.

One of the new test cases (fixedbugs/issue27232.go) exposed a
go/types issue. The test case is excluded from the go/types test
suite and an issue was filed (#28576).

Updates #18640.
Updates #23823.
Updates #24939.
Updates #25838.
Updates #28576.

Fixes #27232.
Fixes #27267.
Fixes #27383.

Change-Id: I6c2d10da98bfc6f4f445c755fcaab17fc7b214c5
Reviewed-on: https://go-review.googlesource.com/c/147286
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
(cherry picked from commit e6305380a067c51223a59baf8a77575595a5f1e6)
Reviewed-on: https://go-review.googlesource.com/c/151339
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/gc/typecheck.go
src/go/types/stdlib_test.go
test/fixedbugs/issue18640.go
test/fixedbugs/issue23823.go
test/fixedbugs/issue24939.go
test/fixedbugs/issue27232.go [new file with mode: 0644]
test/fixedbugs/issue27267.go [new file with mode: 0644]