Clojurians
#cljs-dev
<
2018-01-17
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

mfikes00:01:18

^ FWIW, https://dev.clojure.org/jira/browse/TRDR-50 (looks like a 3 year-old Clojure->ClojureScript tools reader porting bug that nobody has noticed until now)

richiardiandrea01:01:08

@mfikes thanks for helping with the issue! I compile with "exit-on-warning" always on and I could not miss it I guess :wink:

richiardiandrea01:01:28

the (easy) patch solves

mfikes02:01:19

@richiardiandrea With the patch in https://dev.clojure.org/jira/browse/CLJS-2473, you get this in JVM ClojureScript

cljs.user=> (int \uD7ff)
WARNING: cljs.core/bit-or, all arguments must be numbers, got [string number] instead. at line 1 <cljs repl>
0
and we also get helpful warnings when running lein test:
WARNING: cljs.core/bit-or, all arguments must be numbers, got [string number] instead. at line 117 /var/folders/gx/nymj3l7x4zq3gxb97v2zwzb40000gn/T/loader-test-out/cljs/tools/reader/edn.cljs
WARNING: cljs.core/bit-or, all arguments must be numbers, got [string number] instead. at line 118 /var/folders/gx/nymj3l7x4zq3gxb97v2zwzb40000gn/T/loader-test-out/cljs/tools/reader/edn.cljs

richiardiandrea02:01:27

Oh so cljs is affected too, well glad we solved

richiardiandrea02:01:25

Oh ok, this is a new patch ;)

mfikes02:01:49

Right, in JVM ClojureScript, if you (+ "a" 1) you will get an invalid arithmetic diagnostic. But, not so for the equivalent (+ \a 1). This patch, if it holds water, infers the \a as being of string type, and thus leads to the desired diagnostic.

mfikes02:01:30

I suspect that it is probably a safe patch because self-hosted ClojureScript has been inferring things that way all along.