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

Handle iterators introduced in Go 1.23 #287

Open
yuxincs opened this issue Oct 10, 2024 · 5 comments
Open

Handle iterators introduced in Go 1.23 #287

yuxincs opened this issue Oct 10, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@yuxincs
Copy link
Contributor

yuxincs commented Oct 10, 2024

Go 1.23 introduced iterators, which NilAway does not support yet. This issue tracks such support.

Initially, we should at least assume these are deeply nonnil without panicking.

yuxincs added a commit that referenced this issue Oct 10, 2024
NilAway is panicking on code that ranges over iterators. This PR adds
initial handling for such that we assume the results from the iterators
are always nonnil, without panicking.

See #287
@yuxincs yuxincs added the enhancement New feature or request label Oct 24, 2024
@spacewander
Copy link

Is there someone still working on this issue? Currently, nilaway can't work with programs written with Go 1.23.

@yuxincs
Copy link
Contributor Author

yuxincs commented Jan 21, 2025

Hey @spacewander , could you share the logs for "nilaway can't work with programs written with Go 1.23"?

We had a PR landed to at least not panicking for iterators, and we assume the results from the iterators are always non-nil (such that it can lead to false negatives), but it should be working fine for other patterns.

@spacewander
Copy link

Glad to hear that there is an ongoing PR addresses this issue!
Sorry for my previous words. In my situation, an APP has been migrated to Go 1.23, and after introducing the iterators feature, the nilaway won't work anymore. Would give a try once the PR is merged. Could you tell me which PR is solving this issue so that I could subscribe to it?

@yuxincs
Copy link
Contributor Author

yuxincs commented Jan 22, 2025

It is actually already merged #288, could you verify that you're on the latest version?

Also, when you say "won't work anymore", could you clarify it a bit? Does it show some errors (panics), or does it simply stop reporting previously-reported diagnostics? 🤔

@spacewander
Copy link

I got some messages about iter when running nilaway with a project configured with Go 1.23:

.../pkg/mod/golang.org/[email protected]/src/slices/iter.go:50:17: cannot range over seq (variable of type iter.Seq[E])
.../pkg/mod/golang.org/[email protected]/src/maps/iter.go:51:20: cannot range over seq (variable of type iter.Seq2[K, V])
.../pkg/mod/golang.org/x/[email protected]/html/iter.go:50:17: cannot range over n.ChildNodes() (value of type iter.Seq[*Node])

Not sure if it is related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants