Skip to content

fix: allow absent inside any-of for missing map keys - #242

Open
felipeofdev-ai wants to merge 1 commit into
nubank:masterfrom
felipeofdev-ai:fix/211-absent-any-of
Open

felipeofdev-ai wants to merge 1 commit into
nubank:masterfrom
felipeofdev-ai:fix/211-absent-any-of

Conversation

@felipeofdev-ai

Copy link
Copy Markdown

Summary

  • Teach Absent to match the map-matching ::missing sentinel so any-of + absent works for missing keys.
  • Add regression tests for missing key, present alternate, and mismatched present value.

Why

Bare absent is special-cased in match-kv, but nested absent (e.g. inside any-of) went through -match, which always failed — so {:a (any-of 'b absent)} never matched a map without :a.

Fixes #211

Test plan

  • clojure -A:dev:clj-test:test-runner -n matcher-combinators.matchers-test (0 failures)
  • Full CI suite

— Felipe Fernandes · Systems & Agentic AI Engineer
https://github.com/felipeofdev-ai · https://felipeofdev-ai.github.io/

Made with Cursor

When absent is nested in any-of, map matching passes ::missing for a
missing key. Treat that as a successful absence match.

Fixes nubank#211

Signed-off-by: Felipe Fernandes <felipe.of.dev@gmail.com>
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.

absent doesn't work with any-of

1 participant