return as;
}
+/*
+ * declare the arguments in an
+ * interface field declaration.
+ */
+void
+ifacedcl(Node *n)
+{
+ if(n->op != ODCLFIELD || n->right == N)
+ fatal("ifacedcl");
+
+ dclcontext = PAUTO;
+ markdcl();
+ funcdepth++;
+ n->outer = curfn;
+ curfn = n;
+ funcargs(n->right);
+
+ // funcbody is normally called after the parser has
+ // seen the body of a function but since an interface
+ // field declaration does not have a body, we must
+ // call it now to pop the current declaration context.
+ funcbody(n);
+}
+
/*
* declare the function proper
* and declare the arguments.
void funccompile(Node *n, int isclosure);
void funchdr(Node *n);
Type* functype(Node *this, NodeList *in, NodeList *out);
+void ifacedcl(Node *n);
int isifacemethod(Type *f);
void markdcl(void);
Node* methodname(Node *n, Type *t);
new_name indcl
{
$$ = nod(ODCLFIELD, $1, $2);
+ ifacedcl($$);
}
| packname
{
--- /dev/null
+// errchk $G $D/$F.go
+
+// Copyright 2011 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.
+
+// Issue 1871.
+
+package p
+
+type a interface {
+ foo(x int) (x int) // ERROR "redeclared|redefinition"
+}
+
+var b interface {
+ bar(y int) (y int) // ERROR "redeclared|redefinition"
+}
+
+/*
+Previously:
+
+bug.go:1 x redclared in this block
+ previous declaration at bug.go:1
+*/