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
Type warning for contains? on seq #1021
Comments
The commit which closed this does not seem right (d3b71fc) While using (contains? [:a :b] :a)
;; => false
(contains? [:a :b] 0)
;; => true
(contains? "abc" \a)
;; => Execution error (IllegalArgumentException) at repro/eval135854 (REPL:83).
;; contains? not supported on type: java.lang.String I believe a better type signature for it would be {:arities {2 {:args [#{:map :set} :any]
:ret boolean}}} If that sounds alright I can open a PR. |
Contains is supported on vectors and strings, but the key should be numeric in that case. Remember that contains checks for key values, and strings are considered arrays keyed by their index. As such, I don't see a reason to change the existing type. |
Thanks for the clarification, I didn't realise it worked on strings depending on the 2nd arg, and I suppose the current type system can't express something like Using |
should give a type warning.
The text was updated successfully, but these errors were encountered: