Commit 2254785c authored by Russ Cox's avatar Russ Cox

cmd/gc: tweak interface satisfaction error message

"M requires pointer receiver" can be misinterpreted to
mean that method M should have a pointer receiver but
does not. In fact the message means "M has a pointer
receiver" (and you don't have a pointer).

Fixes #5891.

R=ken2
CC=golang-dev
https://golang.org/cl/11313043
parent 918922cf
......@@ -1260,7 +1260,7 @@ assignop(Type *src, Type *dst, char **why)
"\t\thave %S%hhT\n\t\twant %S%hhT", src, dst, missing->sym,
have->sym, have->type, missing->sym, missing->type);
else if(ptr)
*why = smprint(":\n\t%T does not implement %T (%S method requires pointer receiver)",
*why = smprint(":\n\t%T does not implement %T (%S method has pointer receiver)",
src, dst, missing->sym);
else if(have)
*why = smprint(":\n\t%T does not implement %T (missing %S method)\n"
......
......@@ -839,7 +839,7 @@ reswitch:
"\t\thave %S%hhT\n\t\twant %S%hhT", n->type, t, missing->sym,
have->sym, have->type, missing->sym, missing->type);
else if(ptr)
yyerror("impossible type assertion:\n\t%T does not implement %T (%S method requires pointer receiver)",
yyerror("impossible type assertion:\n\t%T does not implement %T (%S method has pointer receiver)",
n->type, t, missing->sym);
else if(have)
yyerror("impossible type assertion:\n\t%T does not implement %T (missing %S method)\n"
......
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