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

go/types: missing "missing return" error #23218

Closed
griesemer opened this issue Dec 21, 2017 · 1 comment
Closed

go/types: missing "missing return" error #23218

griesemer opened this issue Dec 21, 2017 · 1 comment

Comments

@griesemer
Copy link
Contributor

@griesemer griesemer commented Dec 21, 2017

For the following function

func _() int {
	panic := func(interface{}) {}
	panic(0)
}

we correctly get a "missing return" error. But if the body is nested in a block

func _() int {
	{
		panic := func(interface{}) {}
		panic(0)
	}
}

go/types silently accepts the code.

The problem is the that Checker.isTerminating (in go/types/return.go) uses the wrong scope to decide if panic refers to the predeclared function or not.

Not urgent as this is a rather esoteric case.

@griesemer griesemer added this to the Go1.11 milestone Dec 21, 2017
@griesemer griesemer self-assigned this Dec 21, 2017
@gopherbot
Copy link

@gopherbot gopherbot commented Dec 21, 2017

Change https://golang.org/cl/85198 mentions this issue: go/types: correctly determine if panic call refers to built-in

Loading

@gopherbot gopherbot closed this in 38f9d75 Feb 12, 2018
@golang golang locked and limited conversation to collaborators Feb 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants