Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: poor error message when invoking method on embedded type #15711

Open
dsymonds opened this issue May 17, 2016 · 4 comments
Open

cmd/compile: poor error message when invoking method on embedded type #15711

dsymonds opened this issue May 17, 2016 · 4 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@dsymonds
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?

go1.6.2

  1. What operating system and processor architecture are you using (go env)?

The playground

  1. What did you do?

https://play.golang.org/p/hsjwmQwtsb

Relevant snippet:

func TestFoo(t *testing.T) {
    t.Fail("what?")
}
  1. What did you expect to see?
prog.go:14: too many arguments in call to t.Fail
  1. What did you see instead?
prog.go:14: too many arguments in call to t.common.Fail

The .common bit is unexpected and an implementation detail. Running godoc testing Fail shows a simple method func (c *T) Fail(), and the fact that testing.T embeds testing.common does not seem useful.

@ianlancetaylor ianlancetaylor added this to the Unplanned milestone May 17, 2016
@odeke-em
Copy link
Member

odeke-em commented Jan 3, 2017

This bug can now be closed. With Go1.8 +e776975, we'll now have a nice message talking about t.common.Fail failing instead of just t.Fail, and that was even fixed in Go1.7
screen shot 2017-01-03 at 1 28 12 am

$ go run main.go 
# command-line-arguments
./main.go:14: too many arguments in call to t.common.Fail
	have (string)
	want ()

The too many arguments improved message was implemented in https://go-review.googlesource.com/25156.

I'll let @bradfitz close it so that we can properly triage and note it as a Go1.7/8 fixed bug.

@ianlancetaylor
Copy link
Contributor

I don't think tracking setting the milestone of a closed bug to a closed milestone makes much difference. Closing this issue.

@dsymonds
Copy link
Contributor Author

dsymonds commented Jan 3, 2017

Sorry, this isn't fixed. My complaint wasn't about the "too many arguments" part. It was about the error referring to the unexported embedded type.

$ go version
go version devel +d698e614a2 Tue Jan 3 19:23:23 2017 +0000 linux/amd64
$ go test
...
./x_test.go:6: too many arguments in call to t.common.Fail
        have (string)
        want ()

That t.common.Fail is the problematic part. My code doesn't (and can't) refer to t.common.

@dsymonds dsymonds reopened this Jan 3, 2017
@odeke-em
Copy link
Member

odeke-em commented Jan 3, 2017

Am sorry about that @dsymonds and @ianlancetaylor, I totally misunderstood that issue, that 1AM clarity. Yap your issue still stands.

@ALTree ALTree changed the title cmd/compile: Poor error message when invoking method on embedded type cmd/compile: poor error message when invoking method on embedded type Sep 22, 2018
@ALTree ALTree added the NeedsFix The path to resolution is known, but the work has not been done. label Sep 22, 2018
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants