Uploaded image for project: 'ClojureScript'
  1. CLJS-2352

Compiler emits invalid JS code for NaN/Inf/-Inf if used with CLJ >= 1.9.0-alpha20

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Completed
    • Affects versions: 1.9.908
    • Fix versions: None
    • Labels:
      None
    • Approval:
      Accepted
    • Patch:
      Code and Test

      Description

      Since 1.9.0-alpha20, Clojure has its own external representations for NaN/Inf/-Inf: ##NaN / ##Inf / ##-Inf, respectively.

      The current CLJS compiler emits code as is for those values, so if it is used with the latest Clojure, it will end up emitting invalid JS code:

      => (let [env (assoc (ana/empty-env) :context :expr)]
           (comp/emit-str (ana/analyze env ##NaN)))
      "##NaN"
      => (let [env (assoc (ana/empty-env) :context :expr)]
           (comp/emit-str (ana/analyze env ##Inf)))
      "##Inf"
      => (let [env (assoc (ana/empty-env) :context :expr)]
           (comp/emit-str (ana/analyze env ##-Inf)))
      "##-Inf"
      

        Attachments

          Activity

            People

            • Assignee:
              dnolen David Nolen
              Reporter:
              sohta Shogo Ohta
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: