From: Russ Cox Date: Thu, 20 Feb 2014 20:42:08 +0000 (-0500) Subject: cmd/gc: explain 'nointerface' method failure X-Git-Tag: go1.3beta1~637 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=574e0f9a4833a0c81bc4ea7efd9ea9bb46cb59b9;p=gostls13.git 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 --- diff --git a/src/cmd/gc/subr.c b/src/cmd/gc/subr.c index f71165d456..a32590e003 100644 --- a/src/cmd/gc/subr.c +++ b/src/cmd/gc/subr.c @@ -1239,6 +1239,9 @@ assignop(Type *src, Type *dst, char **why) if(why != nil) { if(isptrto(src, TINTER)) *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) *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,