Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Self-host: arithmetic form meta missing :numeric
Description
If you analyze (+ 1 1) in bootstrap, you won't get :numeric true in the form-meta in analyze-js-star*.
In regular ClojureScript, you'll get:
{:js-op cljs.core/+, :numeric true}
but in bootstrap, you'll get:
{:js-op cljs.core/+}
You can see this as well if you look at the Analysis section of David's "ClojureScript Next" blog post, where you get :numeric nil in the AST rather than :numeric true.
One consequence is that :invalid-arithmetic analysis diagnostics won't be emitted in bootstrapped environments.
Analysis: In cljs.analyzer/macroexpand-1*, the mac-var is obtained and its meta is checked for :cljs.analyzer/numeric. The problem is that this is a cljs.core/Var obtained from the findInternedVar method on cljs.core/Namespace, which slaps on a degenerate var-meta with the map
{:ns this}
If I add some code to print the var, I get #'cljs.core$macros/+, and at the Planck REPL (and presumably all bootstrapped REPLs), if I evaluate meta #'cljs.core$macros/+, I see that the desired :cljs.analyzer/numeric is present.
I think that perhaps I can instead add a :cljs conditional branch to this code to try to fish the meta out of the compiler metadata.
If you analyze
(+ 1 1)
in bootstrap, you won't get:numeric true
in theform-meta
inanalyze-js-star*
.In regular ClojureScript, you'll get:
{:js-op cljs.core/+, :numeric true}
but in bootstrap, you'll get:
{:js-op cljs.core/+}
You can see this as well if you look at the Analysis section of David's "ClojureScript Next" blog post, where you get
:numeric nil
in the AST rather than:numeric true
.One consequence is that
:invalid-arithmetic
analysis diagnostics won't be emitted in bootstrapped environments.