ClojureScript

Expose an undocumented Closure compiler DiagnosticGroup

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Not Reproducible
  • Affects Version/s: 1.7.145
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code

Description

Following the tutorial on (Compile Time Type checking wiki)https://github.com/clojure/clojurescript/wiki/Compile-Time-Type-Checking, I noticed that the compiler is producing a lot of warning and errors by default such as:

```
ERROR: JSC_WRONG_ARGUMENT_COUNT. Function cljs.core.array_seq: called with 2 argument(s). Function requires at least 1 argument(s) and no more than 1 argument(s). at ..../hello_world/out/cljs/core.js line 17738 : 186
```

These errors and warnings can be disabled by turning off an undocumented DiagosticGroup: (LINT_CHECKS)https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/DiagnosticGroups.java#L465

Activity

Hide
David Nolen added a comment -

This patch looks ok, Rohit have you submitted your CA? Thanks.

Show
David Nolen added a comment - This patch looks ok, Rohit have you submitted your CA? Thanks.
Hide
Rohit Aggarwal added a comment -

Hi David,
I've signed the Clojure CA and my name is listed here. Thanks a lot!

Show
Rohit Aggarwal added a comment - Hi David, I've signed the Clojure CA and my name is listed here. Thanks a lot!
Hide
Mike Fikes added a comment -

I tried validating the patch, but I cannot reproduce the problem in the description, even with 1.7.170.

Show
Mike Fikes added a comment - I tried validating the patch, but I cannot reproduce the problem in the description, even with 1.7.170.
Hide
Rohit Aggarwal added a comment -

Hi Mike,
I just created a project using the mies template and changed the release.clj file to:

(require '[cljs.build.api :as b])

(println "Building ...")

(let [start (System/nanoTime)]
  (b/build "src"
    {:output-to "release/hello_world.js"
     :output-dir "release"
     :optimizations :advanced
     :closure-warnings {:check-types :error}
     :verbose true})
  (println "... done. Elapsed" (/ (- (System/nanoTime) start) 1e9) "seconds"))

Now when I do

scripts/release

I get warning like:

ERROR: JSC_WRONG_ARGUMENT_COUNT. Function cljs.core.println: called with 0 argument(s). Function requires at least 1 argument(s) and no more than 1 argument(s). at .../hello-world/release/cljs/repl.js line 174 : 0
Show
Rohit Aggarwal added a comment - Hi Mike, I just created a project using the mies template and changed the release.clj file to:
(require '[cljs.build.api :as b])

(println "Building ...")

(let [start (System/nanoTime)]
  (b/build "src"
    {:output-to "release/hello_world.js"
     :output-dir "release"
     :optimizations :advanced
     :closure-warnings {:check-types :error}
     :verbose true})
  (println "... done. Elapsed" (/ (- (System/nanoTime) start) 1e9) "seconds"))
Now when I do
scripts/release
I get warning like:
ERROR: JSC_WRONG_ARGUMENT_COUNT. Function cljs.core.println: called with 0 argument(s). Function requires at least 1 argument(s) and no more than 1 argument(s). at .../hello-world/release/cljs/repl.js line 174 : 0
Hide
Mike Fikes added a comment -

Thanks Rohit,

I get errors for a lein new mies hello-world project, but they are different than the one you quote above.

I do get two JSC_WRONG_ARGUMENT_COUNT diagnostics:

ERROR: JSC_WRONG_ARGUMENT_COUNT. Function goog.net.WebSocket.prototype.isOpen: called with 1 argument(s). Function requires at least 0 argument(s) and no more than 0 argument(s). at /Users/mfikes/Desktop/foobar/hello-world/release/clojure/browser/net.js line 591 : 7
ERROR: JSC_WRONG_ARGUMENT_COUNT. Function goog.net.WebSocket.prototype.close: called with 1 argument(s). Function requires at least 0 argument(s) and no more than 0 argument(s). at /Users/mfikes/Desktop/foobar/hello-world/release/clojure/browser/net.js line 613 : 7

Then when revising the project to use the compiler built with the attached patch, I tried adding

:lint-checks :off

to the :closure-warnings map, but this doesn't make these go away.

Hrm... I wonder what explains the difference.

Show
Mike Fikes added a comment - Thanks Rohit, I get errors for a lein new mies hello-world project, but they are different than the one you quote above. I do get two JSC_WRONG_ARGUMENT_COUNT diagnostics:
ERROR: JSC_WRONG_ARGUMENT_COUNT. Function goog.net.WebSocket.prototype.isOpen: called with 1 argument(s). Function requires at least 0 argument(s) and no more than 0 argument(s). at /Users/mfikes/Desktop/foobar/hello-world/release/clojure/browser/net.js line 591 : 7
ERROR: JSC_WRONG_ARGUMENT_COUNT. Function goog.net.WebSocket.prototype.close: called with 1 argument(s). Function requires at least 0 argument(s) and no more than 0 argument(s). at /Users/mfikes/Desktop/foobar/hello-world/release/clojure/browser/net.js line 613 : 7
Then when revising the project to use the compiler built with the attached patch, I tried adding
:lint-checks :off
to the :closure-warnings map, but this doesn't make these go away. Hrm... I wonder what explains the difference.
Hide
Rohit Aggarwal added a comment -

Mike,
You are correct about the warning with the patch.

:lint-checks :off

But I see that the number of errors is greatly reduced for me.

If it helps, I am using OS X 10.11.4 and Java 1.8.0_71

Show
Rohit Aggarwal added a comment - Mike, You are correct about the warning with the patch.
:lint-checks :off
But I see that the number of errors is greatly reduced for me. If it helps, I am using OS X 10.11.4 and Java 1.8.0_71
Hide
Mike Fikes added a comment -

I'm seeing no effect with :lint-checks :off.

I'm on OS X 10.11.3 with Java 1.8.0_72, and I'm trying this against the current master of the ClojureScript tree.

Show
Mike Fikes added a comment - I'm seeing no effect with :lint-checks :off. I'm on OS X 10.11.3 with Java 1.8.0_72, and I'm trying this against the current master of the ClojureScript tree.
Hide
Rohit Aggarwal added a comment -

This ticket is invalid. Hence closing.

Show
Rohit Aggarwal added a comment - This ticket is invalid. Hence closing.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: