We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b68e8b5 commit c0045c5Copy full SHA for c0045c5
2 files changed
src/main/cljs/cljs/core.cljs
@@ -5693,9 +5693,9 @@ reduces them without incurring seq initialization"
5693
5694
IFn
5695
(-invoke [coll k]
5696
- (-nth coll k))
5697
- (-invoke [coll k not-found]
5698
- (-nth coll k not-found))
+ (if (number? k)
+ (-nth coll k)
+ (throw (js/Error. "Key must be integer"))))
5699
5700
IEditableCollection
5701
(-as-transient [coll]
src/test/cljs/cljs/collections_test.cljs
@@ -1080,6 +1080,10 @@
1080
(persistent! t)
1081
(is (= :fail (try (get t :a :not-found) (catch js/Error e :fail))))))
1082
1083
+(deftest test-cljs-3317
1084
+ (testing "persistent vector invoke matches clojure"
1085
+ (is (thrown-with-msg? js/Error #"Key must be integer" ([1 2] nil)))))
1086
+
1087
(comment
1088
1089
(run-tests)
0 commit comments