]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/gc: improve "type *X has no field or method M" message
authorDavid Chase <drchase@google.com>
Tue, 5 May 2015 17:25:58 +0000 (13:25 -0400)
committerDavid Chase <drchase@google.com>
Thu, 7 May 2015 16:21:57 +0000 (16:21 +0000)
commitd4bb72b485cc9aa790e3a176b2e728e2d28d52ed
treec9e01bede7dbcb76a8ebb25804d901f23eb69193
parentfa896733b5670514361b17fb88c783420af2dbad
cmd/internal/gc: improve "type *X has no field or method M" message

Try to provide hints for common areas, either *interface
were interface would have been better, and note incorrect
capitalization (but don't be more ambitious than that, at
least not today).

Added code and test for cases

  ptrInterface.ExistingMethod
  ptrInterface.unexportedMethod
  ptrInterface.MissingMethod
  ptrInterface.withwRongcASEdMethod
  interface.withwRongcASEdMethod
  ptrStruct.withwRongcASEdMethod
  struct.withwRongcASEdMethod

also included tests for related errors to check for
unintentional changes and consistent wording.

Somewhat simplified from previous versions to avoid second-
guessing user errors, yet also biased to point out most-likely
root cause.

Fixes #10700

Change-Id: I16693e93cc8d8ca195e7742a222d640c262105b4
Reviewed-on: https://go-review.googlesource.com/9731
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/internal/gc/typecheck.go
test/fixedbugs/issue10700.dir/other.go [new file with mode: 0644]
test/fixedbugs/issue10700.dir/test.go [new file with mode: 0644]
test/fixedbugs/issue10700.go [new file with mode: 0644]
test/interface/embed2.go