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

Add checks for better map assertions #5

Merged
merged 20 commits into from
Jan 27, 2024
Merged

Add checks for better map assertions #5

merged 20 commits into from
Jan 27, 2024

Conversation

jzbrooks
Copy link
Owner

@jzbrooks jzbrooks commented Dec 27, 2023

Fixes #3

@jzbrooks jzbrooks marked this pull request as ready for review January 21, 2024 21:04
@jzbrooks
Copy link
Owner Author

@evant, if you have some time to sanity check this conceptually, I'd appreciate it!

0 errors, 1 warnings""",
)
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you care about usages like map.entries.map { it.key }?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. Have you seen that call before in the wild?

It strikes me as odd to iterate the entries to read a set that the map is probably already maintaining internally, but if people do that for whatever reason…

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, honestly I'm not sure; I was mostly trying to find edge cases related to keys.

I think I've written it before, but probably incorrectly 🙂

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to merge this, but I created #11 to track interest in something like that over time. I explained a little of my rationale there.

@jzbrooks jzbrooks merged commit c75dab8 into master Jan 27, 2024
2 checks passed
@jzbrooks jzbrooks deleted the map-assertions branch March 8, 2024 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Detect uses of Map.keys property extraction for checking if a key does not exist.
2 participants