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: panic.Fatalf should not report "use of builtin panic not in function call" but instead "panic.Fatalf undefined (builtin panic has no field or method Fatalf)" #43285

Closed
odeke-em opened this issue Dec 20, 2020 · 7 comments
Assignees
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

@odeke-em
Copy link
Member

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

At pre-Go1.16 on tip 55b5801

Does this issue reproduce with the latest release?

Yes

What did you do?

, running this code https://play.golang.org/p/akRcEUKPrTA or inlined below

package main

func main() {
	panic.Fatalf("foo")
}

What did you expect to see?

panic.Fatalf undefined (builtin panic has no field or method Fatalf)

What did you see instead?

use of builtin panic not in function call

which would be similar to panic being present on a line but without any invocation https://play.golang.org/p/35T1E3Xttpp or

package main

func main() {
	panic
}
./prog.go:4:2: use of builtin panic not in function call
@odeke-em odeke-em added this to the Unplanned milestone Dec 20, 2020
@choleraehyq
Copy link
Contributor

choleraehyq commented Dec 20, 2020

How to figure out whether an error message is wrong? There is no specification about it. IMHO the current error message is not confusing.

@cagedmantis cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 22, 2020
@cagedmantis
Copy link
Contributor

/cc @randall77 @griesemer

@mdempsky
Copy link
Contributor

I think either error message is fine here. However, go/types reports the requested error message, so this will likely change once we adopt types2 anyway.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 13, 2022
@odeke-em
Copy link
Member Author

In Go1.23 given

package main

func main() {
	panic.Fatalf("foo")
}

produces

cannot select on panic (built-in)

That's a much more mysterious message sine we've adopted types2.

@griesemer griesemer self-assigned this Oct 30, 2024
@griesemer griesemer modified the milestones: Unplanned, Go1.24 Oct 30, 2024
@griesemer
Copy link
Contributor

I'll fix the error message.

@griesemer griesemer added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 30, 2024
@gopherbot gopherbot removed the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 30, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/623756 mentions this issue: go/types, types2: better error message when selecting on a built-in

@odeke-em
Copy link
Member Author

odeke-em commented Nov 2, 2024

Thank you @griesemer and long time!

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

6 participants