ClojureScript

Self-host: arithmetic form meta missing :numeric

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: 1.7.145
  • Fix Version/s: None
  • Component/s: None
  • Labels:

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.

Activity

Hide
Mike Fikes added a comment -

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.

Show
Mike Fikes added a comment - 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.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: