Commit 574e0f9a authored by Russ Cox's avatar Russ Cox

cmd/gc: explain 'nointerface' method failure

The message used to say that there was a type
mismatch, which is not necessarily true.

TBR=ken2
CC=golang-codereviews
https://golang.org/cl/66600044
parent a8a7f18a
...@@ -1239,6 +1239,9 @@ assignop(Type *src, Type *dst, char **why) ...@@ -1239,6 +1239,9 @@ assignop(Type *src, Type *dst, char **why)
if(why != nil) { if(why != nil) {
if(isptrto(src, TINTER)) if(isptrto(src, TINTER))
*why = smprint(":\n\t%T is pointer to interface, not interface", src); *why = smprint(":\n\t%T is pointer to interface, not interface", src);
else if(have && have->sym == missing->sym && have->nointerface)
*why = smprint(":\n\t%T does not implement %T (%S method is marked 'nointerface')",
src, dst, missing->sym);
else if(have && have->sym == missing->sym) else if(have && have->sym == missing->sym)
*why = smprint(":\n\t%T does not implement %T (wrong type for %S method)\n" *why = smprint(":\n\t%T does not implement %T (wrong type for %S method)\n"
"\t\thave %S%hhT\n\t\twant %S%hhT", src, dst, missing->sym, "\t\thave %S%hhT\n\t\twant %S%hhT", src, dst, missing->sym,
......
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