]> Cypherpunks repositories - gostls13.git/commitdiff
address bug193 and add note to spec about it.
authorRuss Cox <rsc@golang.org>
Tue, 20 Oct 2009 15:27:14 +0000 (08:27 -0700)
committerRuss Cox <rsc@golang.org>
Tue, 20 Oct 2009 15:27:14 +0000 (08:27 -0700)
R=ken
OCL=35920
CL=35920

doc/go_spec.html
src/cmd/gc/const.c
src/cmd/gc/subr.c
src/cmd/gc/typecheck.c
test/bugs/placeholder [new file with mode: 0644]
test/fixedbugs/bug193.go [moved from test/bugs/bug193.go with 100% similarity]
test/golden.out
test/run

index 1f0b52090422678ff7af8a56fb0a36362e884950..40c65dfdbd52128d4f39e85af1c5413b5fefd9d6 100644 (file)
@@ -9,6 +9,7 @@ Todo
     (struct{T} vs struct {T T} vs struct {t T})
 [ ] need explicit language about the result type of operations
 [ ] may want to have some examples for the types of shift operations
+[ ] should string(1<<s) and float(1<<s) be valid?
 [ ] should probably write something about evaluation order of statements even
        though obvious
 [ ] specify iteration direction for range clause
index dd0cc15e527edb0f39e611207db016a558a603b0..582990419679b234bd66b9a27397a9aef91a610d 100644 (file)
@@ -96,7 +96,7 @@ convlit1(Node **np, Type *t, int explicit)
                break;
        case OLSH:
        case ORSH:
-               convlit(&n->left, t);
+               convlit1(&n->left, t, explicit);
                t = n->left->type;
                if(t != T && !isint[t->etype]) {
                        yyerror("invalid operation: %#N (shift of type %T)", n, t);
@@ -292,7 +292,7 @@ tostr(Val v)
 
        case CTFLT:
                yyerror("no float -> string");
-       
+
        case CTNIL:
                memset(&v, 0, sizeof v);
                v.ctype = CTSTR;
index 06a05895b116263df9061540c77b2a896a559be7..ccb2b765304dc814b2dce27c192068e56f97caca 100644 (file)
@@ -1455,11 +1455,12 @@ Zconv(Fmt *fp)
                s += chartorune(&r, s);
                switch(r) {
                default:
+                       if(r < ' ') {
+                               fmtprint(fp, "\\x%02x", r);
+                               break;
+                       }
                        fmtrune(fp, r);
                        break;
-               case '\0':
-                       fmtstrcpy(fp, "\\x00");
-                       break;
                case '\t':
                        fmtstrcpy(fp, "\\t");
                        break;
index 6c90004cfb8eb5526e39dc6ef22e6fdcad3213ab..b87da542554bb3eed67376fbe1a0df896c40215e 100644 (file)
@@ -765,7 +765,7 @@ reswitch:
        doconv:
                ok |= Erv;
                typecheck(&n->left, Erv | (top & Eindir));
-               defaultlit(&n->left, n->type);
+               convlit1(&n->left, n->type, 1);
                if((t = n->left->type) == T || n->type == T)
                        goto error;
                n = typecheckconv(n, n->left, n->type, 1);
diff --git a/test/bugs/placeholder b/test/bugs/placeholder
new file mode 100644 (file)
index 0000000..b816d34
--- /dev/null
@@ -0,0 +1,2 @@
+This file keeps Mercurial from deleting the directory
+when there are no known bugs.
similarity index 100%
rename from test/bugs/bug193.go
rename to test/fixedbugs/bug193.go
index 79c2990bb1baf8b39c1ed8c4e23b1c3d6e1810ec..c87d7e519e93cfd4cdb87804c8bfa83d29f710d7 100644 (file)
@@ -201,6 +201,3 @@ throw: interface conversion
 panic PC=xxx
 
 == bugs/
-
-=========== bugs/bug193.go
-BUG: errchk: bugs/bug193.go:14: missing expected error: 'shift'
index aa4b6003d2b4f0c93f08922bb649d4b3924d9f8d..164636a3a0f3e3075bbdbbd5b280ca9408a1949b 100755 (executable)
--- a/test/run
+++ b/test/run
@@ -47,7 +47,7 @@ for dir in . ken chan interface nilptr fixedbugs bugs
 do
        echo
        echo '==' $dir'/'
-       for i in $dir/*.go
+       for i in $(ls $dir/*.go 2>/dev/null)
        do
                export F=$(basename $i .go)
                export D=$dir
@@ -75,8 +75,9 @@ done | # clean up some stack noise
        egrep -v '^(r[0-9a-z]+|[cfg]s)  +0x'  |
        sed '/tmp.*Bus error/s/.*Bus/Bus/; /tmp.*Trace.BPT/s/.*Trace/Trace/
                s!'$RUNFILE'!$RUNFILE!g
-               s/ PC=0x[0-9a-f]*/ PC=xxx/
+               s/^PC=0x[0-9a-f]*/pc: xxx/
                s/^pc: 0x[0-9a-f]*/pc: xxx/
+               s/PC=0x[0-9a-f]*/PC=xxx/
                /^Trace\/breakpoint trap/d
                /^Trace\/BPT trap/d
                /RUNFILE/ s/line 1: *[0-9]*/line 1: PID/