<< Back to previous view

[CLJS-1947] cljs.spec "and" passes :cljs.spec/invalid in next spec after failed if there are 4+ sub-specs Created: 19/Feb/17  Updated: 19/Feb/17

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 1.9.293
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Vlad Protsenko Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: bug, clojurescript, spec


 Description   

This bug affects version 1.9.473, but I could not select it in select box, and I did not test it on other versions.

;; This code will print :cljs.spec/invalid once:
(s/conform (s/and pos? println println println) 0)
:cljs.spec/invalid
=> :cljs.spec/invalid

;; This code does not print anything
(s/conform (s/and pos? println println) 0)
=> :cljs.spec/invalid





[CLJS-536] clj->js trims the namespace prefix from keywords while writing them to string Created: 12/Jul/13  Updated: 19/Feb/17  Resolved: 02/Dec/13

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Vasile Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: clj->js

Attachments: Text File 0001-CLJS-536-Add-support-for-namespaced-keywords.patch     Text File 0001-CLJS-536-Add-support-for-namespaced-keywords.patch    

 Description   

The following behavior was observed and confirmed from the code:

(clj->js :ns/n) => "n"

I believe this is a limitation and the namespace of the keyword should be kept while writing it to string.
The code in core.js does this while handling keywords:

(keyword? x) (name x)

while it should do this (or something similar):

(keyword? x) (str (namespace x) "/" (name x))



 Comments   
Comment by Vasile [ 12/Jul/13 12:03 PM ]

a better (working) fix: (keyword? x) (str (if (namespace x) (str (namespace x) "/")) (name x))

Comment by David Nolen [ 16/Jul/13 6:22 AM ]

I'd be willing to take a patch that allows this behavior to be configured.

Comment by Niklas Närhinen [ 01/Nov/13 7:33 AM ]

Proposed fix

Comment by Niklas Närhinen [ 01/Nov/13 7:37 AM ]

Fixed version of patch

Comment by David Nolen [ 01/Nov/13 9:23 AM ]

Excellent, Niklas I don't see you on the list of contributors, please send in your Contributor Agreement, http://clojure.org/contributing, so we can apply the patch.

Comment by David Nolen [ 02/Dec/13 8:52 PM ]

I looked more closely at the clj->js source, the system is already customizable. We can't determine ahead of time how you might want to emit keywords and symbols - thus you can extend Keyword and Symbol to IEncodeJS yourself and get the desired behavior.

Comment by Andrea Richiardi [ 17/Jan/17 2:52 PM ]

I have just stumbled across this one, shall we at least say it in the docstring of clj->js that we are losing the namespace part?

Comment by Jozef Wagner [ 19/Feb/17 4:11 AM ]

With the introduction of specs, the namespaced keywords are being used more and more. This issue prevents streamlined edn->json->edn transformation. I think it should be reopened. IMO the 'lossy' method should never be a default one.

Comment by Paulus Esterhazy [ 19/Feb/17 5:53 AM ]

Unless we are willing to break existing code, I don't think it will be possible to change the default behavior.

I'm also not sure that extending IEncodeJS is the best solution, as it affects every call to clj->js, including calls to libraries which may rely on the ns-stripping behavior.

However, the attached patch allows you to make the decision on a per-call basis.

One quibble with the patch: perhaps it would be better to use kwargs style `(clj->js v :preserve-namespaces true)` in line with `js->clj`?





[CLJS-1946] Self-hosted: don't emit `goog.require` calls for foreign libs if optimizations different than `:none` Created: 18/Feb/17  Updated: 18/Feb/17

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: Next

Type: Defect Priority: Minor
Reporter: António Nuno Monteiro Assignee: David Nolen
Resolution: Unresolved Votes: 0
Labels: None

Attachments: Text File CLJS-1946.patch    
Patch: Code

 Description   

This is done in JVM CLJS but not in self-hosted.






[CLJS-1945] cljs.spec/every-impl kind-fn kind-form dead code Created: 18/Feb/17  Updated: 18/Feb/17

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Mike Fikes Assignee: David Nolen
Resolution: Unresolved Votes: 0
Labels: None

Attachments: Text File CLJS-1945.patch    
Patch: Code

 Description   

With Clojure 386e7e6 a [kindfn kindform] let was removed here

https://github.com/clojure/clojure/commit/386e7e63485bcb7bed050df2c2b54a6ceca05e5f#diff-b0f91f319d0c76aadf667da929b08d37L1031

this upstream revision was not copied in ClojureScript 1a297c5 around here:

https://github.com/clojure/clojurescript/commit/1a297c52d958520065335815ffb3dee07c314aa7#diff-5c48ec6d047e1ea6fdcdd00b4f09f45eR729

and is currently dead code that could be removed.






[CLJS-1944] Can't spec generate non-vector collections Created: 18/Feb/17  Updated: 18/Feb/17

Status: In Progress
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Mike Fikes Assignee: David Nolen
Resolution: Unresolved Votes: 0
Labels: None

Attachments: Text File CLJS-1944.patch    
Patch: Code and Test

 Description   

If you use cljs.spec/coll-of with non-vector :kind, you can't exercise the spec.

Repro:

$ java -jar cljs.jar -m cljs.repl.node
ClojureScript Node.js REPL server listening on 58736
To quit, type: :cljs/quit
cljs.user=> (require '[clojure.spec :as s] 'clojure.test.check.generators)
true
cljs.user=> (s/exercise (s/coll-of string? :kind set?))
Error: Couldn't satisfy such-that predicate after 100 tries.
...


 Comments   
Comment by Mike Fikes [ 18/Feb/17 11:48 AM ]

This is a cut-n-dry defect simply involving missing this Clojure deletion:

https://github.com/clojure/clojure/commit/23e3ec3f8bceeedee70beed7a17846c25eba05a6#diff-b0f91f319d0c76aadf667da929b08d37L1208

in this ClojureScript tracking change here:

https://github.com/clojure/clojurescript/commit/cd43ec9bf40605e230dc8858c2855f9ad85b39d8#diff-5c48ec6d047e1ea6fdcdd00b4f09f45eL702

The consequence is that gen-into is always non-nil (set to []) and then kind is not made use of here: https://github.com/clojure/clojurescript/blob/627f7fd513d928531db48392d8f52142fea5eb38/src/main/cljs/cljs/spec.cljs#L890-L891





[CLJS-1943] Self-host: `cljs.pprint`'s macros can't be compiled Created: 15/Feb/17  Updated: 17/Feb/17

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: Next

Type: Defect Priority: Major
Reporter: António Nuno Monteiro Assignee: David Nolen
Resolution: Unresolved Votes: 0
Labels: bootstrap

Attachments: Text File CLJS-1943-2.patch     Text File CLJS-1943.patch    
Patch: Code and Test

 Comments   
Comment by António Nuno Monteiro [ 15/Feb/17 6:46 PM ]

Attached patch with fix and enabled running the cljs.pprint tests when running the self-parity tests.





[CLJS-1935] When calling cljs.spec/valid?, subsequent predicates of cljs.spec/and are evaluated even when early predicate is unsatisfied Created: 11/Feb/17  Updated: 16/Feb/17  Resolved: 15/Feb/17

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Henrik Lundahl Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: clojure.spec

Attachments: Text File CLJS-1935.patch    

 Description   

Affects 1.9.456 and 1.9.473.

The problem is that subsequent predicates of cljs.spec/and are evaluated even when an early predicate is unsatisfied when calling cljs.spec/valid?.

See https://github.com/henriklundahl/minimal-cljs-spec-problem for a minimal example demonstrating the problem.



 Comments   
Comment by David Nolen [ 11/Feb/17 10:49 AM ]

Please do not link outside. Minimal examples need to be in the ticket. This means no project. Just code demonstrating the problem. Thanks.

Comment by Henrik Lundahl [ 12/Feb/17 7:59 AM ]

Since I'm not allowed to edit the description I'll just add the details here.

The following code renders an exception:

(ns asdf
(:require [clojure.spec :as s]))

(defn pred-1? [s]
(> (count s) 100))

(defn pred-2? [s]
(> (count s) 100))

(defn pred-3? [s]
(> (count s) 100))

(s/valid? (s/and string? pred-1? pred-2? pred-3?) "a")

The exception is something like:

Uncaught Error: No protocol method ICounted.-count defined for type cljs.core/Keyword: :cljs.spec/invalid

This works in both Clojure 1.9.0-alpha14 and ClojureScript 1.9.293. It does not work in neither ClojureScript 1.9.456 nor ClojureScript 1.9.473.

Comment by David Nolen [ 15/Feb/17 5:38 PM ]

fixed https://github.com/clojure/clojurescript/commit/ff0b11c123bf46d9e0efff164a7327fb269d2262

Comment by Henrik Lundahl [ 16/Feb/17 12:47 AM ]

Thanks!





[CLJS-1636] Mark some symbols in core macros ns as private Created: 27/Apr/16  Updated: 15/Feb/17  Resolved: 15/Feb/17

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Mike Fikes Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File CLJS-1636-2.patch     Text File CLJS-1636-3.patch     Text File CLJS-1636.patch    
Patch: Code

 Description   

There are some symbols in the core macros namespace that are not meant for external consumption. Some of these are marked private and some aren't. This ticket asks that the others be marked private as well.

An example of one symbol marked private is defcurried.
An example of one symbol not marked private is caching-hash.



 Comments   
Comment by Mike Fikes [ 27/Apr/16 8:21 AM ]

In CLJS-1636.patch, I checked and it appears nothing in the compiler codebase is explicitly using these symbols outside of the cljs.core namespace. But, it is still worth scanning through these to check if they make sense. For example js-debugger and js-comment are a couple that might actually be meant for public use, but it is difficult to tell.

Comment by Mike Fikes [ 27/Apr/16 2:43 PM ]

Note, that in #cljs-dev slack, there appears to be interest in caching-hash being public.

(I don't mind revising the patch to suit whatever is needed. At the same time, I'm certainly not in a position to take decisions on what is public API or not.)

Comment by Mike Fikes [ 27/Apr/16 2:43 PM ]

Note, that in #cljs-dev slack, there appears to be interest in caching-hash being public.

(I don't mind revising the patch to suit whatever is needed. At the same time, I'm certainly not in a position to take decisions on what is public API or not.)

Comment by Mike Fikes [ 31/Jul/16 1:33 PM ]

Patch no longer applies. Attaching updated patch.

Comment by Mike Fikes [ 12/Feb/17 1:33 PM ]

Previous patch no longer applies; attaching re-baselined patch.

Comment by David Nolen [ 15/Feb/17 5:46 PM ]

fixed https://github.com/clojure/clojurescript/commit/627f7fd513d928531db48392d8f52142fea5eb38





[CLJS-1939] Bad load_file generated for foreign-dep requires on Node Created: 13/Feb/17  Updated: 15/Feb/17  Resolved: 15/Feb/17

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Juho Teperi Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File CLJS-1939-1.patch    

 Description   

After CLJS-1922 ijs :file is preferred as output-path when writing the JS files to output-dir. compiler/load-libs still uses util/relative-name for all cases, which won't work when the JS file is loaded from classpath and written to output-dir using classpath path.

Fix is to use the same logic in load-files to build the path as is used in closure/rel-output-path.



 Comments   
Comment by David Nolen [ 15/Feb/17 5:44 PM ]

fixed https://github.com/clojure/clojurescript/commit/90fc275d939f6c701096378134a930adbd9493f3





[CLJS-1942] Self-host: `cljs.env.macros` and `cljs.analyzer.macros` can't be loaded Created: 14/Feb/17  Updated: 15/Feb/17  Resolved: 15/Feb/17

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: Next

Type: Defect Priority: Major
Reporter: António Nuno Monteiro Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: bootstrap

Attachments: Text File CLJS-1942.patch    
Patch: Code

 Comments   
Comment by António Nuno Monteiro [ 14/Feb/17 3:50 PM ]

Attached patch with fix.

Comment by David Nolen [ 15/Feb/17 5:41 PM ]

fixed https://github.com/clojure/clojurescript/commit/47cd1cef8f7ed5b16cffc7e2ae4d223328091ab7





[CLJS-1941] `cljs.compiler/cljs-files-in` shouldn't return `.cljc` files if a `.cljs` file exists for the namespace Created: 14/Feb/17  Updated: 14/Feb/17

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: Next

Type: Defect Priority: Major
Reporter: António Nuno Monteiro Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Attachments: Text File CLJS-1941.patch    
Patch: Code

 Description   

We're seeing non-determinism in builds due to this problem. This is the same bug as CLJS-1772, but happens at a different code path.



 Comments   
Comment by António Nuno Monteiro [ 14/Feb/17 12:26 PM ]

Attached patch with fix.





[CLJS-1940] Undeclared var warning when invoking a protocol method on a `js` interop form Created: 14/Feb/17  Updated: 14/Feb/17

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Nicola Mometto Assignee: David Nolen
Resolution: Unresolved Votes: 0
Labels: interop, protocols, regression


 Description   

Compiling the following code under 1.9.743

(ns test.foo)

(defprotocol Proto
  (f [this]))

(defn foo []
  (f js/Math.E))

Produces the following warning:

WARNING: Use of undeclared Var test.foo/js at line 7 src/test/foo.cljs

This is a regression from 1.9.293

https://github.com/Bronsa/CLJS-1.9.473-regression contains a project set up to reproduce this






[CLJS-1938] :elide-asserts compiler option without effect Created: 13/Feb/17  Updated: 13/Feb/17  Resolved: 13/Feb/17

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Thomas Heller Assignee: Unassigned
Resolution: Not Reproducible Votes: 0
Labels: None


 Description   

Some self-host related things broke the :elide-asserts compiler option.

cljs.closure/build is the only place that binds *assert* when the :elide-asserts option is set. This however binds the clojure.core dynamic var, the cljs.core/assert macro however uses the cljs.core dynamic var. Therefore this is always true and asserts are never removed.

Possible fixes:
[1] change to cljs.core/*assert*.
[2] change to (core/when core/*assert* ...

I would like to revisit http://dev.clojure.org/jira/browse/CLJS-1494 and always emit the asserts but wrapped in a goog-define so Closure is able to remove them without us actually affecting the generated JS.

[1] https://github.com/clojure/clojurescript/blob/af2ca808fcc5efc088b48957b898fed0b59eddbe/src/main/clojure/cljs/closure.clj#L2091
[2] https://github.com/clojure/clojurescript/blob/af2ca808fcc5efc088b48957b898fed0b59eddbe/src/main/clojure/cljs/core.cljc#L2247



 Comments   
Comment by Thomas Heller [ 13/Feb/17 7:05 AM ]

Sorry for the noise, my conclusion was wrong. Looked at the wrong file.





[CLJS-1936] cljs.analyzer declares vars which are only used in Clojure Created: 11/Feb/17  Updated: 12/Feb/17

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: Next

Type: Defect Priority: Major
Reporter: António Nuno Monteiro Assignee: David Nolen
Resolution: Unresolved Votes: 0
Labels: None

Attachments: Text File CLJS-1936.patch    
Patch: Code

 Description   

We shouldn't be declaring these vars on the ClojureScript side, as they can lead to runtime errors when trying to call those functions from the self-hosted compiler. Putting them under reader conditionals enables emitting warnings when they are used.






[CLJS-1937] Self-host: undeclared cljs.core$macros/mod when compiling cljs/core.cljs Created: 12/Feb/17  Updated: 12/Feb/17

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: Next

Type: Defect Priority: Minor
Reporter: António Nuno Monteiro Assignee: David Nolen
Resolution: Unresolved Votes: 0
Labels: None

Attachments: Text File CLJS-1937.patch    
Patch: Code

 Comments   
Comment by António Nuno Monteiro [ 12/Feb/17 11:32 PM ]

Attached patch with fix.





Generated at Sun Feb 19 12:38:30 CST 2017 using JIRA 4.4#649-r158309.