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

cmd/gc: spurious 'invalid receiver type' error #3709

Closed
rsc opened this issue Jun 6, 2012 · 1 comment
Closed

cmd/gc: spurious 'invalid receiver type' error #3709

rsc opened this issue Jun 6, 2012 · 1 comment

Comments

@rsc
Copy link
Contributor

rsc commented Jun 6, 2012

The bug depends on the order in which the compiler sees declarations. Underlying cause
of issue #3707.

$ cat p.go
package p

type T1 struct { F *T2 }
type T2 T1

type T3 T2
func (*T3) M()

$ go tool 6g p.go
p.go:7: invalid receiver type *T3
go tool 6g: exit status 1

But if we swap the two blocks of code:

$ cat p1.go
package p

type T3 T2
func (*T3) M()

type T1 struct { F *T2 }
type T2 T1

$ go tool 6g p1.go
$
@rsc
Copy link
Contributor Author

rsc commented Jun 7, 2012

Comment 1:

This issue was closed by revision 6363fc5.

Status changed to Fixed.

@rsc rsc added fixed labels Jun 7, 2012
@rsc rsc self-assigned this Jun 7, 2012
@rsc rsc added this to the Go1.0.2 milestone Apr 14, 2015
@rsc rsc removed the go1.0.2 label Apr 14, 2015
rsc added a commit that referenced this issue May 11, 2015
««« backport e69400ace361
cmd/gc: fix type checking loop

CL 4313064 fixed its test case but did not address a
general enough problem:

type T1 struct { F *T2 }
type T2 T1
type T3 T2

could still end up copying the definition of T1 for T2
before T1 was done being evaluated, or T3 before T2
was done.

In order to propagate the updates correctly,
record a copy of an incomplete type for re-execution
once the type is completed. Roll back CL 4313064.

Fixes #3709.

R=ken2
CC=golang-dev, lstoakes
https://golang.org/cl/6301059

»»»
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants