compiler: report correct errors for sink methods
authorIan Lance Taylor <ian@gcc.gnu.org>
Tue, 16 May 2017 00:02:03 +0000 (00:02 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 16 May 2017 00:02:03 +0000 (00:02 +0000)
commitd73b8f8417ebf6f0bbf64f237fa9db11cfc719f4
treeb982f2031b658201fc0d5f049e5eaee1a3e90755
parenta5768d38a66fc4136208bc8442a4118df2bd588f
compiler: report correct errors for sink methods

    If somebody writes

    func (s []int) _() {}

    we should report an error.  Before this patch we were silently
    accepting this code, because we didn't report any errors about the
    receiver if the method was a sink.

    This patch is unfortunately slightly complex to handle the case of

    func (x int) _() {}

    which we can only detect after define_global_names.

    This fixes blank1.go in the current gc testsuite.

    Reviewed-on: https://go-review.googlesource.com/43456

From-SVN: r248081
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/gogo.cc
gcc/go/gofrontend/gogo.h
gcc/go/gofrontend/types.cc
gcc/go/gofrontend/types.h