Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible breakage with ClojureScript 1.10.439 #37

Closed
arichiardi opened this issue Nov 21, 2018 · 2 comments
Closed

Possible breakage with ClojureScript 1.10.439 #37

arichiardi opened this issue Nov 21, 2018 · 2 comments

Comments

@arichiardi
Copy link
Collaborator

Hello!

I have noticed some possible breakage with the new ClojureScript 1.10.439. The way humane pretty prints the diff will likely break. I have not tried but I am copying that piece of code somewhere around here as well and it broke 😄

The repro looks like this:

[Rebel readline] Type :repl/help for online help info
cljs.user=> (require '[cljs.pprint :as pprint])
cljs.user=> (require '[goog.string :as gstring])
cljs.user=> (import '[goog.string StringBuffer])
nil
cljs.user=> (defn with-pretty-writer* [f]
       #_=>   (binding [*sb* (StringBuffer.)
       #_=>             *out* (pprint/get-pretty-writer (StringBufferWriter. *sb*))]
       #_=>     (f)))

#'cljs.user/write*
cljs.user=> (defn- write* [s]
       #_=>   (cljs.core/-write cljs.core/*out* s))

cljs.user=> (with-pretty-writer* #(write* "test"))
TypeError: Cannot read property "append" from undefined
	 cljs$core$IWriter$_write$arity$2 (.cljs_nashorn_repl/cljs/core.cljs:874:17)
	 cljs$core$_write (.cljs_nashorn_repl/cljs/core.cljs:750:1)
	 <anonymous> (.cljs_nashorn_repl/cljs/pprint.cljs:212:14)
	 cljs.core/-write (.cljs_nashorn_repl/cljs/core.cljs:750:1)
	 <anonymous> (.cljs_nashorn_repl/cljs/pprint.cljs:525:18)
	 cljs$core$_write (.cljs_nashorn_repl/cljs/core.cljs:750:1)
	 (<NO_SOURCE_FILE> <eval>:3:0)
	 (<NO_SOURCE_FILE> <eval>:2:0)
	 (<NO_SOURCE_FILE> <eval>:11:0)
	 (<NO_SOURCE_FILE> <eval>:1:0)
	 (<NO_SOURCE_FILE> <eval>:1:0)
	 (<NO_SOURCE_FILE> <eval>:1:0)

I will try to put together a fix but can't promise and of course we are on our own for using the binding that way 😄

@arichiardi
Copy link
Collaborator Author

arichiardi commented Nov 21, 2018

Confirmed on Slack:

mfikes [< 1 minute ago]
Yes that binding of sb and its use in the same binding won’t work

@immoh
Copy link

immoh commented Nov 26, 2018

Confirmed, seeing this when tests fail (PhantomJS):

actual: #object[TypeError TypeError: undefined is not an object (evaluating 'self__.sb.append')]

arichiardi added a commit that referenced this issue Feb 1, 2019
The old way of testing with phantom js was broken with the new ClojureScript so
this patch moves to a more modern setup using lein-doo.
At this point tests are still failing because of bug #37.
pjstadig added a commit that referenced this issue Oct 7, 2019
[Fix #37] Correct the binding and test with modern ClojureScript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants