compiler: improvements for type alias handling
Give an error for an attempt to define a method on an imported type.
Give an error for each attempt to define a method on a builtin type.
Adjust error messages to be closer to gc error messages.
With these changes gccgo passes current tests on dev.typealias branch.
This changes the errors printed for test/fixedbugs/issue5089.go, but
the change is an improvement:
Before:
fixedbugs/issue5089.go:13:1: error: redefinition of ‘bufio.Buffered’: receiver name changed
func (b *bufio.Reader) Buffered() int { // ERROR "non-local|redefinition"
^
fixedbugs/issue5089.go:11:13: note: previous definition of ‘bufio.Buffered’ was here
import "bufio" // GCCGO_ERROR "previous"
^
Now:
fixedbugs/issue5089.go:13:7: error: may not define methods on non-local type
func (b *bufio.Reader) Buffered() int { // ERROR "non-local|redefinition"
^
Reviewed-on: https://go-review.googlesource.com/35642
From-SVN: r244889