Which displays both the code (line breaks unescaped here for convenience) and resulting error:
"var x_22 = 1;
var x_23__$1 = (x_23 + 1);
cljs.core.prn.call(null,x_23__$1);
cljs.core.prn.call(null,x_22);"
VM1654:2 Uncaught ReferenceError: x_23 is not defined
This issue is more noticeable than in the case encountered via "doseq", as the naming error occurs in a read position rather than write, so we get an error instead of unexpected behaviour.
This has the cause as http://dev.clojure.org/jira/browse/CLJS-1400, but demonstrates a more provocative compilation error.
Sample code using cljs.js to demonstrate the failure:
(cljs/eval (cljs/empty-state) '(let [x 1] (let [x (inc x)] (prn x)) (prn x)) {:eval (juxt (comp prn :source) cljs/js-eval)} (fn [& _]))
Which displays both the code (line breaks unescaped here for convenience) and resulting error:
"var x_22 = 1; var x_23__$1 = (x_23 + 1); cljs.core.prn.call(null,x_23__$1); cljs.core.prn.call(null,x_22);" VM1654:2 Uncaught ReferenceError: x_23 is not defined
This issue is more noticeable than in the case encountered via "doseq", as the naming error occurs in a read position rather than write, so we get an error instead of unexpected behaviour.
The patch attached fixies this and 1400