Commit 256df10e authored by Quan Yong Zhai's avatar Quan Yong Zhai Committed by Russ Cox

gc: fix copy([]int, string) error message

R=rsc
CC=golang-dev
https://golang.org/cl/4433064
parent 29d78f12
......@@ -1006,9 +1006,13 @@ reswitch:
defaultlit(&n->right, T);
// copy([]byte, string)
if(isslice(n->left->type) && n->left->type->type == types[TUINT8] && n->right->type->etype == TSTRING)
goto ret;
if(isslice(n->left->type) && n->right->type->etype == TSTRING) {
if (n->left->type->type ==types[TUINT8])
goto ret;
yyerror("arguments to copy have different element types: %lT and string", n->left->type);
goto error;
}
if(!isslice(n->left->type) || !isslice(n->right->type)) {
if(!isslice(n->left->type) && !isslice(n->right->type))
yyerror("arguments to copy must be slices; have %lT, %lT", n->left->type, n->right->type);
......
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