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

alpha12 fails with "UnsupportedOperationException nth not supported on this type: PersistentArrayMap" #2

Closed
ulsa opened this issue Sep 13, 2016 · 2 comments

Comments

@ulsa
Copy link

ulsa commented Sep 13, 2016

The following works with alpha11, but not alpha12:

(require '[clojure.spec :as s])
(require '[clojure.future :refer :all])
(require '[clojure.spec.test :as stest])

(s/def ::n nat-int?)
=> :user/n

(s/fdef sample
        :args (s/cat :some-map (s/keys :req-un [::n])))
=> user/sample

(defn sample [some-map]
  some-map)

(stest/instrument 'user/sample)
=> [user/sample]

(sample {:n 6})
UnsupportedOperationException nth not supported on this type: PersistentArrayMap  clojure.lang.RT.nthFrom (RT.java:947)

With alpha11:

...
(sample {:n 6})
=> {:n 6}
@ulsa
Copy link
Author

ulsa commented Sep 14, 2016

Just tested with Clojure 1.9-alpha12 and it works fine. So it seems to be something related to the backport.

@tonsky tonsky closed this as completed in 4dbb75b Sep 14, 2016
@tonsky
Copy link
Owner

tonsky commented Sep 14, 2016

Looks like it was related to changes in clojure.core which I don’t port. In 1.9 it’s ok to destructure map as sequence, in 1.8 it is not:

(let [[x & xs] {:n 6}]) => java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap

taylorwood added a commit to taylorwood/clojure-future-spec that referenced this issue May 2, 2017
tonsky pushed a commit that referenced this issue May 2, 2017
* Fix regression on #2

* Fix README typo
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

No branches or pull requests

2 participants