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 negative in contract support #259

Open
sonalmahajan15 opened this issue Jun 21, 2024 · 0 comments
Open

False negative in contract support #259

sonalmahajan15 opened this issue Jun 21, 2024 · 0 comments

Comments

@sonalmahajan15
Copy link
Contributor

Below is a case of false negative when using non-literals. Replacing return x with return nil, works as expected

func fooReturn(x *int) *int {
	if x == nil {
		return x
	}
	return new(int)
}

func barReturn1(n int) {
	b1 := fooReturn(nil)
	print(*b1) // Expected: ERROR!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant