humane-test-output icon indicating copy to clipboard operation
humane-test-output copied to clipboard

Warnings for using private vars (ClojureScript)

Open immoh opened this issue 6 years ago • 5 comments

Using [org.clojure/clojurescript "1.10.439"] will produce lot of warning about private vars:

WARNING: var: cljs.pprint/level-exceeded is not public at line 12 target/out/pjstadig/util.cljc
WARNING: var: cljs.pprint/*current-level* is not public at line 12 target/out/pjstadig/util.cljc
WARNING: var: cljs.pprint/*current-length* is not public at line 12 target/out/pjstadig/util.cljc
WARNING: var: cljs.pprint/*current-level* is not public at line 12 target/out/pjstadig/util.cljc
WARNING: var: cljs.pprint/*current-length* is not public at line 12 target/out/pjstadig/util.cljc
WARNING: var: cljs.pprint/*current-level* is not public at line 12 target/out/pjstadig/util.cljc
WARNING: var: cljs.pprint/start-block is not public at line 12 target/out/pjstadig/util.cljc
WARNING: var: cljs.pprint/end-block is not public at line 12 target/out/pjstadig/util.cljc
WARNING: var: cljs.pprint/level-exceeded is not public at line 24 target/out/pjstadig/util.cljc
WARNING: var: cljs.pprint/*current-level* is not public at line 24 target/out/pjstadig/util.cljc
WARNING: var: cljs.pprint/*current-length* is not public at line 24 target/out/pjstadig/util.cljc
WARNING: var: cljs.pprint/*current-level* is not public at line 24 target/out/pjstadig/util.cljc
WARNING: var: cljs.pprint/*current-length* is not public at line 24 target/out/pjstadig/util.cljc
WARNING: var: cljs.pprint/*current-level* is not public at line 24 target/out/pjstadig/util.cljc
WARNING: var: cljs.pprint/start-block is not public at line 24 target/out/pjstadig/util.cljc
WARNING: var: cljs.pprint/end-block is not public at line 24 target/out/pjstadig/util.cljc

immoh avatar Nov 12 '18 07:11 immoh

Yep, ClojureScript has become stricter but these warnings are unavoidable because the lib is using hidden APIs from cljs.pprint

arichiardi avatar Nov 12 '18 16:11 arichiardi

warnings could be probably removed by using var indirection as described here: https://clojurescript.org/news/2018-11-02-release#_warnings_on_private_var_use (I intend to give it a try some time after current pr gets merged).

nenadalm avatar Oct 07 '19 14:10 nenadalm

I've merged and released version 0.10.0.

pjstadig avatar Oct 07 '19 18:10 pjstadig

@pjstadig thanks for looking into this. Unfortunately, I'm still seeing the same issue with 0.10.0

[Figwheel] Validating figwheel-main.edn
[Figwheel] figwheel-main.edn is valid \(ツ)/
[Figwheel] Compiling build common:test to "target/public/719998b2-df4b-4b86-9793-3f821d281369/js/app.js"
[Figwheel:WARNING] Compile Warning   target/public/cljs-out/common:test/pjstadig/util.cljc   line:12  column:3

  var: cljs.pprint/level-exceeded is not public

   7                [pjstadig.print :as p]
   8                [cljs.test :refer [inc-report-counter! testing-vars-str testing-contexts-str get-current-env]]]))
   9    #?(:cljs (:import [goog.string StringBuffer])))
  10
  11  (defn- print-seq [aseq]
  12    (pp/pprint-logical-block
        ^---
  13     (pp/write-out (ffirst aseq))
  14     (p/rprint " ")
  15     (pp/pprint-newline :linear)
  16     ;; [pjs] this is kind of ugly, but it is a private var :(
  17     ;; always print both parts of the [k v] pair

[Figwheel:WARNING] Compile Warning   target/public/cljs-out/common:test/pjstadig/util.cljc   line:12  column:3

  var: cljs.pprint/*current-level* is not public

   7                [pjstadig.print :as p]
   8                [cljs.test :refer [inc-report-counter! testing-vars-str testing-contexts-str get-current-env]]]))
   9    #?(:cljs (:import [goog.string StringBuffer])))
  10
  11  (defn- print-seq [aseq]
  12    (pp/pprint-logical-block
        ^---
  13     (pp/write-out (ffirst aseq))
  14     (p/rprint " ")
  15     (pp/pprint-newline :linear)
  16     ;; [pjs] this is kind of ugly, but it is a private var :(
  17     ;; always print both parts of the [k v] pair

[Figwheel:WARNING] Compile Warning   target/public/cljs-out/common:test/pjstadig/util.cljc   line:12  column:3

  var: cljs.pprint/*current-length* is not public

   7                [pjstadig.print :as p]
   8                [cljs.test :refer [inc-report-counter! testing-vars-str testing-contexts-str get-current-env]]]))
   9    #?(:cljs (:import [goog.string StringBuffer])))
  10
  11  (defn- print-seq [aseq]
  12    (pp/pprint-logical-block
        ^---
  13     (pp/write-out (ffirst aseq))
  14     (p/rprint " ")
  15     (pp/pprint-newline :linear)
  16     ;; [pjs] this is kind of ugly, but it is a private var :(
  17     ;; always print both parts of the [k v] pair

[Figwheel:WARNING] Compile Warning: var: cljs.pprint/*current-level* is not public  target/public/cljs-out/common:test/pjstadig/util.cljc   line:12  column:3
[Figwheel:WARNING] Compile Warning: var: cljs.pprint/*current-length* is not public  target/public/cljs-out/common:test/pjstadig/util.cljc   line:12  column:3
[Figwheel:WARNING] Compile Warning: var: cljs.pprint/*current-level* is not public  target/public/cljs-out/common:test/pjstadig/util.cljc   line:12  column:3
[Figwheel:WARNING] Compile Warning: var: cljs.pprint/start-block is not public  target/public/cljs-out/common:test/pjstadig/util.cljc   line:12  column:3
[Figwheel:WARNING] Compile Warning: var: cljs.pprint/end-block is not public  target/public/cljs-out/common:test/pjstadig/util.cljc   line:12  column:3
[Figwheel:WARNING] Compile Warning: var: cljs.pprint/level-exceeded is not public  target/public/cljs-out/common:test/pjstadig/util.cljc   line:24  column:3
[Figwheel:WARNING] Compile Warning: var: cljs.pprint/*current-level* is not public  target/public/cljs-out/common:test/pjstadig/util.cljc   line:24  column:3
[Figwheel:WARNING] Compile Warning: var: cljs.pprint/*current-length* is not public  target/public/cljs-out/common:test/pjstadig/util.cljc   line:24  column:3
[Figwheel:WARNING] Compile Warning: var: cljs.pprint/*current-level* is not public  target/public/cljs-out/common:test/pjstadig/util.cljc   line:24  column:3
[Figwheel:WARNING] Compile Warning: var: cljs.pprint/*current-length* is not public  target/public/cljs-out/common:test/pjstadig/util.cljc   line:24  column:3
[Figwheel:WARNING] Compile Warning: var: cljs.pprint/*current-level* is not public  target/public/cljs-out/common:test/pjstadig/util.cljc   line:24  column:3
[Figwheel:WARNING] Compile Warning: var: cljs.pprint/start-block is not public  target/public/cljs-out/common:test/pjstadig/util.cljc   line:24  column:3
[Figwheel:WARNING] Compile Warning: var: cljs.pprint/end-block is not public  target/public/cljs-out/common:test/pjstadig/util.cljc   line:24  column:3

From figwheel.main's deps.edn

                              pjstadig/humane-test-output {:mvn/version "0.10.0"}

pesterhazy avatar Oct 17 '19 14:10 pesterhazy

@pesterhazy I don't think that warnings were removed yet. It waits till somebody sends PR :)

nenadalm avatar Oct 17 '19 17:10 nenadalm