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

False positive on unassigned variable guarded by switch #238

Open
sonalmahajan15 opened this issue Apr 30, 2024 · 1 comment
Open

False positive on unassigned variable guarded by switch #238

sonalmahajan15 opened this issue Apr 30, 2024 · 1 comment
Labels
false positive Requires more analysis and support

Comments

@sonalmahajan15
Copy link
Contributor

NilAway reports a false positive error for the switch case as shown below. The switch case

func test() {
	var x interface{}

	switch v := x.(type) {
	case nil:
		// do nothing
	case *int:
		print(*v)  // error: unassigned variable `x` dereferenced
	default:
		// do nothing
	}
}
@sonalmahajan15 sonalmahajan15 added the false positive Requires more analysis and support label Apr 30, 2024
@sonalmahajan15
Copy link
Contributor Author

sonalmahajan15 commented Apr 30, 2024

(Similar issues #12 , #110 , #215 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
false positive Requires more analysis and support
Projects
None yet
Development

No branches or pull requests

1 participant