1
0
mirror of https://github.com/golang/go synced 2024-11-25 12:47:56 -07:00

gc: undo attempt at fixing recursive interface embedding

Fixes #582.

Update #287
Status: Accepted
Bug fix was too intrusive; undo and reopen issue.

R=ken2
CC=golang-dev
https://golang.org/cl/209044
This commit is contained in:
Russ Cox 2010-02-16 17:44:15 -08:00
parent 855986d54f
commit 7b5789b584
6 changed files with 33 additions and 20 deletions

View File

@ -122,9 +122,6 @@ walkdeflist(NodeList *l)
walkdef(l->n); walkdef(l->n);
} }
static NodeList *deftypequeue;
static int intypedef;
static void static void
walkdeftype(Node *n) walkdeftype(Node *n)
{ {
@ -265,21 +262,7 @@ walkdef(Node *n)
n->walkdef = 1; n->walkdef = 1;
n->type = typ(TFORW); n->type = typ(TFORW);
n->type->sym = n->sym; n->type->sym = n->sym;
intypedef++; walkdeftype(n);
if(intypedef > 1)
deftypequeue = list(deftypequeue, n);
else {
walkdeftype(n);
while(deftypequeue != nil) {
NodeList *l;
l = deftypequeue;
deftypequeue = nil;
for(; l; l=l->next)
walkdeftype(l->n);
}
}
intypedef--;
break; break;
case OPACK: case OPACK:

View File

@ -19,9 +19,9 @@ type I4 interface {
} }
type I5 interface { type I5 interface {
I6 // ERROR "interface" I6
} }
type I6 interface { type I6 interface {
I5 I5 // ERROR "interface"
} }

16
test/fixedbugs/bug256.go Normal file
View File

@ -0,0 +1,16 @@
// errchk $G -e $D/$F.go
// Copyright 2010 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 main
type T U // bogus "invalid recursive type T" from 6g
type U int
const x T = 123
type V V // ERROR "invalid recursive type"

View File

@ -150,3 +150,17 @@ throw: interface conversion
panic PC=xxx panic PC=xxx
== bugs/ == bugs/
=========== bugs/bug250.go
bugs/bug250.go:14: interface type loop involving I1
bugs/bug250.go:17: need type assertion to use I2 as I1
missing m() I2
BUG: bug250
=========== bugs/bug251.go
BUG: errchk: bugs/bug251.go:11: missing expected error: 'loop|interface'
errchk: bugs/bug251.go: unmatched error messages:
==================================================
bugs/bug251.go:15: interface type loop involving I1
bugs/bug251.go:19: need type assertion to use I2 as I1
==================================================