]> Cypherpunks repositories - gostls13.git/commitdiff
fix both of anton's bugs:
authorRuss Cox <rsc@golang.org>
Sat, 4 Apr 2009 06:20:51 +0000 (23:20 -0700)
committerRuss Cox <rsc@golang.org>
Sat, 4 Apr 2009 06:20:51 +0000 (23:20 -0700)
* 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

src/cmd/gc/walk.c
src/lib/io/pipe_test.go

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