Commit 61590c4c authored by Russ Cox's avatar Russ Cox

disallow P.t for lowercase t and not our package P.

implement hiding lowercase methods m in
signatures by adding in a hash of the package name
to the type hash code.

remove remaining checks for internally-generated _ names:
they are all gone.

R=ken
OCL=23236
CL=23238
parent c3fa54c4
......@@ -57,9 +57,8 @@ if(throwreturn == N) {
// add clearing of the output parameters
t = structfirst(&save, getoutarg(curfn->type));
while(t != T) {
if(t->nname != N && t->nname->sym->name[0] != '_') {
if(t->nname != N)
curfn->nbody = list(nod(OAS, t->nname, N), curfn->nbody);
}
t = structnext(&save);
}
}
......
......@@ -658,6 +658,8 @@ dumpsigt(Type *progt, Type *ifacet, Type *rcvrt, Type *methodt, Sym *s)
a->name = method->name;
a->hash = PRIME8*stringhash(a->name) + PRIME9*typehash(f->type, 0);
if(!exportname(a->name))
a->hash += PRIME10*stringhash(package);
a->perm = o;
a->sym = methodsym(method, rcvrt);
......@@ -767,7 +769,6 @@ dumpsigi(Type *t, Sym *s)
int o;
Sig *a, *b;
Prog *p;
char *sp;
char buf[NSYMB];
at.sym = s;
......@@ -784,19 +785,15 @@ dumpsigi(Type *t, Sym *s)
s1 = f->sym;
if(s1 == nil)
continue;
if(s1->name[0] == '_')
continue;
b = mal(sizeof(*b));
b->link = a;
a = b;
a->name = s1->name;
sp = strchr(s1->name, '_');
if(sp != nil)
a->name = sp+1;
a->hash = PRIME8*stringhash(a->name) + PRIME9*typehash(f->type, 0);
if(!exportname(a->name))
a->hash += PRIME10*stringhash(package);
a->perm = o;
a->sym = methodsym(f->sym, t);
a->offset = 0;
......
......@@ -433,7 +433,7 @@ funcargs(Type *ft)
while(t != T) {
if(t->nname != N)
t->nname->xoffset = t->width;
if(t->nname != N && t->nname->sym->name[0] != '_') {
if(t->nname != N) {
addvar(t->nname, t->type, PPARAM);
all |= 1;
} else
......
......@@ -34,6 +34,7 @@ enum
PRIME7 = 10067,
PRIME8 = 10079,
PRIME9 = 10091,
PRIME10 = 10093,
AUNK = 100,
// these values are known by runtime
......
......@@ -685,6 +685,8 @@ talph:
s = pkglookup(s->name, context);
if(s->lexical == LIGNORE)
goto l0;
if(!exportname(s->name) && strcmp(package, s->opackage) != 0)
s = pkglookup(s->name, ".private");
}
DBG("lex: %S %s\n", s, lexname(s->lexical));
......
......@@ -1683,12 +1683,8 @@ eqtype(Type *t1, Type *t2, int d)
if(t1->nname != N && t1->nname->sym != S) {
if(t2->nname == N || t2->nname->sym == S)
return 0;
if(strcmp(t1->nname->sym->name, t2->nname->sym->name) != 0) {
// assigned names dont count
if(t1->nname->sym->name[0] != '_' ||
t2->nname->sym->name[0] != '_')
return 0;
}
if(strcmp(t1->nname->sym->name, t2->nname->sym->name) != 0)
return 0;
}
t1 = t1->down;
t2 = t2->down;
......@@ -2489,7 +2485,7 @@ expand0(Type *t)
u = methtype(t);
if(u != T) {
for(f=u->method; f!=T; f=f->down) {
if(!exportname(f->sym->name) && strcmp(f->sym->package, package) != 0)
if(!exportname(f->sym->name) && strcmp(f->sym->opackage, package) != 0)
continue;
if(f->sym->uniq)
continue;
......
......@@ -168,6 +168,13 @@ throw:
prints(": missing method ");
prints((int8*)iname);
prints("\n");
if(iface_debug) {
prints("interface");
printsigi(si);
prints("\ntype");
printsigt(st);
prints("\n");
}
throw("interface conversion");
}
m->bad = 1;
......
......@@ -232,7 +232,7 @@ fixedbugs/bug074.go:7: x: undefined
fixedbugs/bug081.go:5: no type x
=========== fixedbugs/bug083.go
BUG: succeeds incorrectly
fixedbugs/bug083.dir/bug1.go:9: syntax error near t0
=========== fixedbugs/bug086.go
fixedbugs/bug086.go:5: function ends without a return statement
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment