Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/types: cyclical type declaration accepted w/o error #8699

Closed
griesemer opened this issue Sep 10, 2014 · 4 comments
Closed

go/types: cyclical type declaration accepted w/o error #8699

griesemer opened this issue Sep 10, 2014 · 4 comments
Labels
early-in-cycle A change that should be done early in the 3 month dev cycle. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

The program:

http://play.golang.org/p/HVo1iZeaiW

is accepted by gotype w/o an error.

Both gc and gccgo complain.

$ gccgo x.go
x.go:3:9: error: array bound is not constant
 type T [len(a)]int
         ^
@griesemer
Copy link
Contributor Author

Comment 2:

Simpler test case:
package p
type T [len(a)]int
var a T

@griesemer
Copy link
Contributor Author

Comment 3:

In some cases the type-checker ignores the fact that the underlying type is incomplete:
When declaring T, as soon as we know that we have an array, T is declared as such with
length 0 (and no element type), but that is sufficient for len(a) to get a useful length
(namely 0).
Fixing this is subtle; it's also an academic case. Delay to 1.5.

Labels changed: added release-go1.5, removed release-go1.4.

@griesemer griesemer self-assigned this Sep 17, 2014
@bradfitz bradfitz modified the milestone: Go1.5 Dec 16, 2014
@rsc rsc removed accepted labels Apr 14, 2015
@rsc rsc changed the title go/types: cyclical type declaration accepted w/o error x/tools/go/types: cyclical type declaration accepted w/o error Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Go1.5 Apr 14, 2015
@rsc rsc removed the repo-tools label Apr 14, 2015
@griesemer griesemer changed the title x/tools/go/types: cyclical type declaration accepted w/o error go/types: cyclical type declaration accepted w/o error Jul 31, 2015
@griesemer griesemer modified the milestones: Unplanned, Unreleased Jul 31, 2015
@griesemer griesemer modified the milestones: Go1.10, Unplanned Jun 29, 2017
@rsc rsc modified the milestones: Go1.10, Go1.11 Nov 22, 2017
@griesemer griesemer added early-in-cycle A change that should be done early in the 3 month dev cycle. NeedsFix The path to resolution is known, but the work has not been done. labels Dec 8, 2017
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/115457 mentions this issue: go/types: report object path in trace mode

gopherbot pushed a commit that referenced this issue May 31, 2018
For debugging only; disabled (dead code) by default
unless internal constant trace flag is set to true.

For #8699.

Change-Id: Ib7b272c6ac8efacccbbbe24650ef500c5a9ddcf5
Reviewed-on: https://go-review.googlesource.com/115457
Reviewed-by: Alan Donovan <adonovan@google.com>
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/116815 mentions this issue: go/types: extend cycle detection past simple type cycles

@golang golang locked and limited conversation to collaborators Jun 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
early-in-cycle A change that should be done early in the 3 month dev cycle. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants