mirror of
https://github.com/golang/go
synced 2024-11-22 00:14:42 -07:00
gc: fix copy([]int, string) error message
R=rsc CC=golang-dev https://golang.org/cl/4433064
This commit is contained in:
parent
29d78f1243
commit
256df10eae
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user