diff options
author | Russ Cox <rsc@golang.org> | 2008-11-05 11:27:50 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2008-11-05 11:27:50 -0800 |
commit | f93e9122d55a438ef33e00d99f90d157e39c0e8a (patch) | |
tree | f3c233209ab5131760a45e54f4314388b4cfe1cc /src/cmd/gc/walk.c | |
parent | e5c26e215de8a476f735265abbe36a77e2501479 (diff) | |
download | golang-f93e9122d55a438ef33e00d99f90d157e39c0e8a.tar.gz |
6g interface changes:
* allow conversion between nil interface and any type.
* mark signatures as DUPOK so that multiple .6 can
contain sigt.*[]byte and only one gets used.
R=ken
OCL=18538
CL=18542
Diffstat (limited to 'src/cmd/gc/walk.c')
-rw-r--r-- | src/cmd/gc/walk.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c index f0627d4f5..ceae4480a 100644 --- a/src/cmd/gc/walk.c +++ b/src/cmd/gc/walk.c @@ -919,10 +919,10 @@ loop: nnew = nod(ONEW, N, N); nnew->type = nvar->type; nnew = newcompat(nnew); - + nas = nod(OAS, nvar, nnew); addtop = list(addtop, nas); - + nas = nod(OAS, nod(OIND, nvar, N), n->left); addtop = list(addtop, nas); @@ -1761,7 +1761,7 @@ loop: return N; } -more: + a = nod(OAS, nodarg(l, fp), r); a = convas(a); nn = list(a, nn); @@ -1786,6 +1786,8 @@ ascompat(Type *t1, Type *t2) // if(eqtype(t2, nilptr, 0)) // return 1; + if(isnilinter(t1)) + return 1; if(isinter(t1)) { if(isinter(t2)) return 1; @@ -1793,6 +1795,8 @@ ascompat(Type *t1, Type *t2) return 1; } + if(isnilinter(t2)) + return 1; if(isinter(t2)) if(ismethod(t1)) return 1; @@ -2649,13 +2653,13 @@ isandss(Type *lt, Node *r) return I2I; return Inone; } - if(ismethod(rt) != T) + if(isnilinter(lt) || ismethod(rt) != T) return T2I; return Inone; } if(isinter(rt)) { - if(ismethod(lt) != T) + if(isnilinter(rt) || ismethod(lt) != T) return I2T; return Inone; } @@ -2682,7 +2686,7 @@ ifaceop(Type *tl, Node *n, int op) a = n; // interface r = a; - s = signame(tl, 0); // sigi + s = signame(tl); // sigi if(s == S) fatal("ifaceop: signame I2T"); a = s->oname; @@ -2701,14 +2705,14 @@ ifaceop(Type *tl, Node *n, int op) a = n; // elem r = a; - s = signame(tr, 0); // sigt + s = signame(tr); // sigt if(s == S) fatal("ifaceop: signame-1 T2I: %lT", tr); a = s->oname; a = nod(OADDR, a, N); r = list(a, r); - s = signame(tl, 0); // sigi + s = signame(tl); // sigi if(s == S) { fatal("ifaceop: signame-2 T2I: %lT", tl); } @@ -2728,7 +2732,7 @@ ifaceop(Type *tl, Node *n, int op) a = n; // interface r = a; - s = signame(tl, 0); // sigi + s = signame(tl); // sigi if(s == S) fatal("ifaceop: signame I2I"); a = s->oname; |