Commit 907cb4f1 authored by Russ Cox's avatar Russ Cox

fix both of anton's bugs:

* make([100]int) was being compiled to
	make([]int), kind of.
* []this = [100]that was working for any this, that.

turned up a typo in pipe_test.go

R=ken
OCL=27081
CL=27081
parent 2a9f1ee2
...@@ -1955,7 +1955,7 @@ ascompat(Type *dst, Type *src) ...@@ -1955,7 +1955,7 @@ ascompat(Type *dst, Type *src)
if(eqtype(dst, src, 0)) if(eqtype(dst, src, 0))
return 1; return 1;
if(isslice(dst) && isfixedarray(src)) if(isslice(dst) && isfixedarray(src) && eqtype(dst->type, src->type, 0))
return 1; return 1;
if(isnilinter(dst) || isnilinter(src)) if(isnilinter(dst) || isnilinter(src))
...@@ -2080,6 +2080,8 @@ makecompat(Node *n) ...@@ -2080,6 +2080,8 @@ makecompat(Node *n)
if(t != T) if(t != T)
switch(t->etype) { switch(t->etype) {
case TARRAY: case TARRAY:
if(!isslice(t))
goto bad;
return arrayop(n, Erv); return arrayop(n, Erv);
case TMAP: case TMAP:
return mapop(n, Erv); return mapop(n, Erv);
...@@ -2087,15 +2089,11 @@ makecompat(Node *n) ...@@ -2087,15 +2089,11 @@ makecompat(Node *n)
return chanop(n, Erv); return chanop(n, Erv);
} }
/* bad:
* ken had code to malloc here, if(!n->diag) {
* but rsc cut it out so that make(int) n->diag = 1;
* is diagnosed as an error (probably meant new). yyerror("cannot make(%T)", t);
* might come back once we know the }
* language semantics for make(int).
*/
yyerror("cannot make(%T)", t);
return n; return n;
} }
...@@ -3223,7 +3221,7 @@ dorange(Node *nn) ...@@ -3223,7 +3221,7 @@ dorange(Node *nn)
ary: ary:
hk = nod(OXXX, N, N); // hidden key hk = nod(OXXX, N, N); // hidden key
tempname(hk, types[TINT]); tempname(hk, types[TINT]);
ha = nod(OXXX, N, N); // hidden array ha = nod(OXXX, N, N); // hidden array
tempname(ha, t); tempname(ha, t);
...@@ -3305,7 +3303,7 @@ chan: ...@@ -3305,7 +3303,7 @@ chan:
hc = nod(OXXX, N, N); // hidden chan hc = nod(OXXX, N, N); // hidden chan
tempname(hc, t); tempname(hc, t);
hv = nod(OXXX, N, N); // hidden value hv = nod(OXXX, N, N); // hidden value
tempname(hv, t->type); tempname(hv, t->type);
......
...@@ -148,7 +148,7 @@ func testPipeReadClose(t *testing.T, async bool) { ...@@ -148,7 +148,7 @@ func testPipeReadClose(t *testing.T, async bool) {
} else { } else {
delayClose(t, w, c); delayClose(t, w, c);
} }
var buf [64]int; var buf [64]byte;
n, err := r.Read(buf); n, err := r.Read(buf);
<-c; <-c;
if err != nil { if err != nil {
......
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