]> Cypherpunks repositories - gostls13.git/commitdiff
bug212, bug213.
authorRuss Cox <rsc@golang.org>
Mon, 9 Nov 2009 07:22:06 +0000 (23:22 -0800)
committerRuss Cox <rsc@golang.org>
Mon, 9 Nov 2009 07:22:06 +0000 (23:22 -0800)
R=ken
http://go/go-review/1026032

src/cmd/gc/print.c
src/cmd/gc/subr.c
src/cmd/gc/swt.c
src/pkg/debug/dwarf/open.go
test/fixedbugs/bug212.go [moved from test/bugs/bug212.go with 97% similarity]
test/fixedbugs/bug213.go [moved from test/bugs/bug213.go with 100% similarity]
test/golden.out

index 14dd57fa175f5e19e58437a98363db0d53d6091a..ce4f721aed9188539a6b27efaffbdf8a3330ed9d 100644 (file)
@@ -328,6 +328,13 @@ exprfmt(Fmt *f, Node *n, int prec)
                }
                fmtprint(f, ")");
                break;
+
+       case OMAKEMAP:
+               fmtprint(f, "make(%#T)", n->type);
+               break;
+
+       case OMAPLIT:
+               fmtprint(f, "map literal");
        }
 
        if(prec > nprec)
index ccb2b765304dc814b2dce27c192068e56f97caca..35a3a2f95145fbc0e3bddd25aaed650e31466890 100644 (file)
@@ -1654,7 +1654,7 @@ iscomposite(Type *t)
 int
 eqtype1(Type *t1, Type *t2, int d, int names)
 {
-       if(d >= 10)
+       if(d >= 20)
                return 1;
        if(t1 == t2)
                return 1;
@@ -1720,14 +1720,19 @@ eqtype1(Type *t1, Type *t2, int d, int names)
                return 1;
 
        case TARRAY:
-               if(t1->bound == t2->bound)
-                       break;
-               return 0;
+               if(t1->bound != t2->bound)
+                       return 0;
+               break;
 
        case TCHAN:
-               if(t1->chan == t2->chan)
-                       break;
-               return 0;
+               if(t1->chan != t2->chan)
+                       return 0;
+               break;
+
+       case TMAP:
+               if(!eqtype1(t1->down, t2->down, d+1, names))
+                       return 0;
+               break;
        }
        return eqtype1(t1->type, t2->type, d+1, names);
 }
index 1cd4cfaa86e72d32b2ac76e54af05c146e7242b2..952c472462c2af647d4f569dbf9457fcd06b18bf 100644 (file)
@@ -313,9 +313,13 @@ casebody(Node *sw, Node *typeswvar)
 
                // botch - shouldnt fall thru declaration
                last = stat->end->n;
-               if(last->op == OXFALL)
+               if(last->op == OXFALL) {
+                       if(typeswvar) {
+                               setlineno(last);
+                               yyerror("cannot fallthrough in type switch");
+                       }
                        last->op = OFALL;
-               else
+               else
                        stat = list(stat, br);
        }
 
@@ -771,7 +775,7 @@ walkswitch(Node *sw)
                sw->ntest = nodbool(1);
                typecheck(&sw->ntest, Erv);
        }
-       
+
        if(sw->ntest->op == OTYPESW) {
                typeswitch(sw);
 //dump("sw", sw);
index 6fc34fed308c4bdd5c2c312f9e1d448cf9049390..1b50beaa4dca070f653b8496005de7b09f11a783 100644 (file)
@@ -51,7 +51,7 @@ func New(abbrev, aranges, frame, info, line, pubnames, ranges, str []byte) (*Dat
                ranges: ranges,
                str: str,
                abbrevCache: make(map[uint32]abbrevTable),
-               typeCache: make(map[uint32]Type),
+               typeCache: make(map[Offset]Type),
        };
 
        // Sniff .debug_info to figure out byte order.
similarity index 97%
rename from test/bugs/bug212.go
rename to test/fixedbugs/bug212.go
index 079bb5791f5d07af96a469e52df0441717054dbe..51df9b8ae869ac5cd955c005a64a77ad16b74edf 100644 (file)
@@ -5,7 +5,7 @@
 // license that can be found in the LICENSE file.
 
 package main
-type I int 
+type I int
 type S struct { f map[I]int }
 var v1 = S{ make(map[int]int) }                // ERROR "cannot|illegal|incompatible|wrong"
 var v2 map[I]int = map[int]int{}       // ERROR "cannot|illegal|incompatible|wrong"
similarity index 100%
rename from test/bugs/bug213.go
rename to test/fixedbugs/bug213.go
index d23369b6ef4dd2d1c4b82ca650f345099167f45b..a7dcd090a23958d0f673237fdfd12055ab2c9b4e 100644 (file)
@@ -201,9 +201,3 @@ throw: interface conversion
 panic PC=xxx
 
 == bugs/
-
-=========== bugs/bug212.go
-BUG: errchk: command succeeded unexpectedly
-
-=========== bugs/bug213.go
-BUG: errchk: command succeeded unexpectedly