1
0
mirror of https://github.com/golang/go synced 2024-11-21 23:24:41 -07:00

address bug193 and add note to spec about it.

R=ken
OCL=35920
CL=35920
This commit is contained in:
Russ Cox 2009-10-20 08:27:14 -07:00
parent 02fd255a14
commit 60ff8cc86f
8 changed files with 13 additions and 11 deletions

View File

@ -9,6 +9,7 @@ Todo
(struct{T} vs struct {T T} vs struct {t T}) (struct{T} vs struct {T T} vs struct {t T})
[ ] need explicit language about the result type of operations [ ] need explicit language about the result type of operations
[ ] may want to have some examples for the types of shift 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 [ ] should probably write something about evaluation order of statements even
though obvious though obvious
[ ] specify iteration direction for range clause [ ] specify iteration direction for range clause

View File

@ -96,7 +96,7 @@ convlit1(Node **np, Type *t, int explicit)
break; break;
case OLSH: case OLSH:
case ORSH: case ORSH:
convlit(&n->left, t); convlit1(&n->left, t, explicit);
t = n->left->type; t = n->left->type;
if(t != T && !isint[t->etype]) { if(t != T && !isint[t->etype]) {
yyerror("invalid operation: %#N (shift of type %T)", n, t); yyerror("invalid operation: %#N (shift of type %T)", n, t);
@ -292,7 +292,7 @@ tostr(Val v)
case CTFLT: case CTFLT:
yyerror("no float -> string"); yyerror("no float -> string");
case CTNIL: case CTNIL:
memset(&v, 0, sizeof v); memset(&v, 0, sizeof v);
v.ctype = CTSTR; v.ctype = CTSTR;

View File

@ -1455,11 +1455,12 @@ Zconv(Fmt *fp)
s += chartorune(&r, s); s += chartorune(&r, s);
switch(r) { switch(r) {
default: default:
if(r < ' ') {
fmtprint(fp, "\\x%02x", r);
break;
}
fmtrune(fp, r); fmtrune(fp, r);
break; break;
case '\0':
fmtstrcpy(fp, "\\x00");
break;
case '\t': case '\t':
fmtstrcpy(fp, "\\t"); fmtstrcpy(fp, "\\t");
break; break;

View File

@ -765,7 +765,7 @@ reswitch:
doconv: doconv:
ok |= Erv; ok |= Erv;
typecheck(&n->left, Erv | (top & Eindir)); 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) if((t = n->left->type) == T || n->type == T)
goto error; goto error;
n = typecheckconv(n, n->left, n->type, 1); n = typecheckconv(n, n->left, n->type, 1);

2
test/bugs/placeholder Normal file
View File

@ -0,0 +1,2 @@
This file keeps Mercurial from deleting the directory
when there are no known bugs.

View File

@ -201,6 +201,3 @@ throw: interface conversion
panic PC=xxx panic PC=xxx
== bugs/ == bugs/
=========== bugs/bug193.go
BUG: errchk: bugs/bug193.go:14: missing expected error: 'shift'

View File

@ -47,7 +47,7 @@ for dir in . ken chan interface nilptr fixedbugs bugs
do do
echo echo
echo '==' $dir'/' echo '==' $dir'/'
for i in $dir/*.go for i in $(ls $dir/*.go 2>/dev/null)
do do
export F=$(basename $i .go) export F=$(basename $i .go)
export D=$dir export D=$dir
@ -75,8 +75,9 @@ done | # clean up some stack noise
egrep -v '^(r[0-9a-z]+|[cfg]s) +0x' | egrep -v '^(r[0-9a-z]+|[cfg]s) +0x' |
sed '/tmp.*Bus error/s/.*Bus/Bus/; /tmp.*Trace.BPT/s/.*Trace/Trace/ sed '/tmp.*Bus error/s/.*Bus/Bus/; /tmp.*Trace.BPT/s/.*Trace/Trace/
s!'$RUNFILE'!$RUNFILE!g 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/
s/PC=0x[0-9a-f]*/PC=xxx/
/^Trace\/breakpoint trap/d /^Trace\/breakpoint trap/d
/^Trace\/BPT trap/d /^Trace\/BPT trap/d
/RUNFILE/ s/line 1: *[0-9]*/line 1: PID/ /RUNFILE/ s/line 1: *[0-9]*/line 1: PID/