Skip to content

Make separate spec cases for filter, map, etc. to handle an empty sequence #76

@elenam

Description

@elenam

Babel specs for filter, map, and possibly other functions allow the first argument to be any to allow the case of an empty sequence (legal in Clojure):

(filter 5 [])

This returns an empty sequence.

However, it leads to a ClassCastException error, not a spec error, on the first argument not being a function when the sequence is not empty, for example:

(filter 5 [1])

We need a special spec case for an empty sequence since otherwise error messages for a very common error are not sufficiently descriptive.

Metadata

Metadata

Labels

bugSomething isn't workingenhancementNew feature or requestneeds explorationNeed to find more specific examples and narrow down the issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions