]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/gc: explain 'nointerface' method failure
authorRuss Cox <rsc@golang.org>
Thu, 20 Feb 2014 20:42:08 +0000 (15:42 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 20 Feb 2014 20:42:08 +0000 (15:42 -0500)
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

src/cmd/gc/subr.c

index f71165d45623b260c0140c75e0f5882509b4ecc1..a32590e003dca0cb95386e032ae18b55bc63d39c 100644 (file)
@@ -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,