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
Labels
early-in-cycle A change that should be done early in the 3 month dev cycle. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

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 early-in-cycle A change that should be done early in the 3 month dev cycle. NeedsFix The path to resolution is known, but the work has not been done. labels Dec 21, 2017
@griesemer griesemer added this to the Go1.11 milestone Dec 21, 2017
@griesemer griesemer self-assigned this Dec 21, 2017
@gopherbot
Copy link
Contributor

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

@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.
Labels
early-in-cycle A change that should be done early in the 3 month dev cycle. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants