Would it make sense to add checks for the following patterns and recommend a user to use case instead?
(cond
(= x :a) ... ;; Any case-supported constant can be used, not just keywords
(= x :b) ...
...)
(condp = x
:a ...
:b ...
...)
(condp contains? x
#{:a} ...
#{:b :c} ...
...)Sure yeah
Would you mind posting an issue about this? What are the edge cases, e.g. should all compared things be of the same type (if you're not doing that sometimes case will fall back to condp I believe)
Sure, will do.
Yeah, I think case does fall back to condp = but only in some cases, and it by itself is an unlikely reason to prefer an explicit condp =.
Ah, except for the performance warning when warn-on-reflection is set and there are hash collisions in the constants.
https://github.com/clj-kondo/clj-kondo/issues/2563
> should all compared things be of the same type
I don't think the type itself matters. Unless all constants are integer numbers that fit into 32 bits, case will uses hashes.
And as shown in the issue, collisions can happen regardless of the types or of whether they're homogeneous.