juji-io / editscript

A library to diff and patch Clojure/ClojureScript data structures
Eclipse Public License 1.0
485 stars 23 forks source link

WARNING: Use of undeclared Var goog.math.Long/getMaxValue at line 1 <cljs repl> #22

Closed Outrovurt closed 3 years ago

Outrovurt commented 3 years ago

I'm trying to use editscript in a figwheel-main ClojureScript environment, however each time I try:

(require '[editscript.core])

I get the following warning message:

WARNING: Use of undeclared Var goog.math.Long/getMaxValue at line 1 <cljs repl>

I've traced the error to src/editscript/diff/a_star.cljc, specifically to

(ns ^:no-doc editscript.diff.a-star
  (:require ,,,
            #?(:cljs [goog.math.Long])))

and further down where it is used:

(defn- access-g
  [g cur]
  (get g cur #?(:clj Long/MAX_VALUE
                :cljs (goog.math.Long/getMaxValue))))

This usage seems to be throwing a warning, though to be honest I'm not entirely sure why. If I try to require the same in the figwheel REPL then evaluate the above, I get the same warning. However if I do the following:

(require '[goog.math.Long :refer [getMaxValue]])

it works fine.

My question is, is this something which even needs fixing, or can the said warning just be ignored or suppressed somehow?

huahaiy commented 3 years ago

If the :refer form works without warning, I can take a PR.

Outrovurt commented 3 years ago

Great, created #23