compiler: report correct errors for sink methods
commitb9a8c7a5ca36d90e087a9114270e201d37379b15
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 May 2017 00:02:03 +0000 (16 00:02 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 May 2017 00:02:03 +0000 (16 00:02 +0000)
treeb982f2031b658201fc0d5f049e5eaee1a3e90755
parent36c2d84721bc71ae1f447787c0bb47ab82c439b0
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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248081 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/gogo.cc
gcc/go/gofrontend/gogo.h
gcc/go/gofrontend/types.cc
gcc/go/gofrontend/types.h