Skip to content

Commit

Permalink
Fixed isNaN + print on List
Browse files Browse the repository at this point in the history
  • Loading branch information
dupuchba committed Nov 6, 2023
1 parent 6a1ef20 commit 9e500d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion clj/src/cljd/core.cljd
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,10 @@
(.-isNaN o) (.write ^StringSink sink "##NaN")
:else (.write ^StringSink sink (.toString o)))))

(extend-type List
IPrint
(-print [o sink] (print-sequential "[" "]" o sink)))

(defn ^bool string?
"Return true if x is a String"
{:inline (fn [x] `(dart/is? ~x String))
Expand Down Expand Up @@ -1689,7 +1693,7 @@
(cond
(.== double/negativeInfinity o) -1048576
(.== double/infinity o) 2146435072
(.== double/nan o) 2146959360
(-> ^double o .-isNaN) 2146959360
true (m3-hash-int (.-hashCode o))))
(-hash-realized? [o] true))

Expand Down
3 changes: 3 additions & 0 deletions clj/test/cljd/test_clojure/core_test_cljd.cljd
Original file line number Diff line number Diff line change
Expand Up @@ -905,3 +905,6 @@
(deftest nil-is-not-a-set-but-disj-must-work
(is (not (set? nil)))
(is (nil? (disj nil :a))))

(deftest dart-lists-obey-print-readably
(is (= "[\"hello\"]" (pr-str #dart ["hello"]))))

0 comments on commit 9e500d9

Please sign in to comment.