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

Golang: fix flow from a map value via a range statement #15613

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

smowton
Copy link
Contributor

@smowton smowton commented Feb 14, 2024

Flow such as the following was broken:

var someMap map[string]string
someMap["someKey"] = source()

for _, val := range someMap {
  sink(val)
}

This is because the store-step relating to the map store used content-kind "map.value", while the read via the range statement used content-kind "array".

Note the case for reading array content now always constrains the read node to have array or slice type, as array content was previously being read from the base over a range statement iterating over a map.

@smowton smowton requested a review from a team as a code owner February 14, 2024 15:01
@github-actions github-actions bot added the Go label Feb 14, 2024
@smowton
Copy link
Contributor Author

smowton commented Feb 14, 2024

DCA: no changes.

@owen-mc
Copy link
Contributor

owen-mc commented Feb 15, 2024

Good catch! How did you notice this? (Edit: I just found where it was reported.) Could you add a test that failed before and now passes?

@mbg
Copy link
Member

mbg commented Feb 15, 2024

@owen-mc FYI, @smowton asked me to review this yesterday and I ended up writing a test for the review which seems to suggest this isn't working (unless I have done something silly). I should have commented that on here rather than on Slack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants