Preserve test.
changeset: 11593:
f1deaf35e1d1
user: Luuk van Dijk <lvd@golang.org>
date: Tue Jan 17 10:00:57 2012 +0100
summary: gc: fix infinite recursion for embedded interfaces
This is causing 'interface type loop' errors during compilation
of a complex program. I don't understand what's happening
well enough to boil it down to a simple test case, but undoing
this change fixes the problem.
The change being undone is fixing a corner case (uses of
pointer to interface in an interface definition) that basically
only comes up in erroneous Go programs. Let's not try to
fix this again until after Go 1.
Unfixes issue 1909.
TBR=lvd
CC=golang-dev
https://golang.org/cl/
5555063
Type*
tointerface(NodeList *l)
{
- Type *t, *f, **tp, **otp, *t1;
+ Type *t, *f, **tp, *t1;
t = typ(TINTER);
- t->orig = typ(TINTER);
tp = &t->type;
- otp = &t->orig->type;
-
for(; l; l=l->next) {
f = interfacefield(l->n);
- *otp = typ(TFIELD);
- **otp = *f;
- otp = &(*otp)->down;
if (l->n->left == N && f->type->etype == TINTER) {
// embedded interface, inline methods
f->type = t1->type;
f->broke = t1->broke;
f->sym = t1->sym;
- f->embedded = 1;
if(f->sym)
f->nname = newname(f->sym);
*tp = f;
if(t->sym != S && t->etype != TFIELD)
dumppkg(t->sym->pkg);
- // fmt will print the ->orig of an interface, which has the original embedded interfaces.
- // be sure to dump them here
- if(t->etype == TINTER)
- for(f=t->orig->type; f; f=f->down)
- if(f->sym == S)
- dumpexporttype(f->type);
-
dumpexporttype(t->type);
dumpexporttype(t->down);
pt->sym->lastlineno = parserline();
declare(n, PEXTERN);
checkwidth(pt);
- } else if(!eqtype(pt->orig, t->orig))
+ } else if(!eqtype(pt->orig, t))
yyerror("inconsistent definition for type %S during import\n\t%lT\n\t%lT", pt->sym, pt, t);
if(debug['E'])
return fmtprint(fp, "map[%T]%T", t->down, t->type);
case TINTER:
- t = t->orig;
fmtstrcpy(fp, "interface {");
for(t1=t->type; t1!=T; t1=t1->down)
- if(!t1->sym) {
- if(t1->down)
- fmtprint(fp, " %T;", t1->type);
- else
- fmtprint(fp, " %T ", t1->type);
- } else if(exportname(t1->sym->name)) {
+ if(exportname(t1->sym->name)) {
if(t1->down)
fmtprint(fp, " %hS%hT;", t1->sym, t1->type);
else
-// $G $D/$F.go || echo "Bug395"
+// echo bug395 is broken # takes 90+ seconds to break
+// # $G $D/$F.go || echo bug395
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
package test
type Foo interface {
- Bar() interface{Foo}
- Baz() interface{Foo}
- Bug() interface{Foo}
+ Bar() interface {
+ Foo
+ }
+ Baz() interface {
+ Foo
+ }
+ Bug() interface {
+ Foo
+ }
}
== fixedbugs/
== bugs/
+
+=========== bugs/bug395.go
+bug395 is broken