Skip to content

Commit bf60427

Browse files
anmonteirodnolen
authored andcommitted
CLJS-2261: Issue using interop record constructors in macros namespaces
Also bumps tools.reader to 1.0.5 which has the fix
1 parent 3057bbe commit bf60427

File tree

7 files changed

+58
-4
lines changed

7 files changed

+58
-4
lines changed

pom.template.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<dependency>
5151
<groupId>org.clojure</groupId>
5252
<artifactId>tools.reader</artifactId>
53-
<version>1.0.3</version>
53+
<version>1.0.5</version>
5454
</dependency>
5555
<dependency>
5656
<groupId>org.clojure</groupId>

project.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
:test-paths ["src/test/clojure" "src/test/cljs" "src/test/self" "src/test/cljs_cp"]
1111
:dependencies [[org.clojure/clojure "1.8.0"]
1212
[org.clojure/data.json "0.2.6"]
13-
[org.clojure/tools.reader "1.0.3"]
13+
[org.clojure/tools.reader "1.0.5"]
1414
[org.clojure/test.check "0.10.0-alpha2" :scope "test"]
1515
[com.cognitect/transit-clj "0.8.300"]
1616
[org.clojure/google-closure-library "0.0-20170519-fa0499ef"]

script/bootstrap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ DJSON_RELEASE="0.2.6"
1010
TRANSIT_RELEASE="0.8.300"
1111
GCLOSURE_LIB_RELEASE="0.0-20160609-f42b4a24"
1212
RHINO_RELEASE="1_7R5"
13-
TREADER_RELEASE="1.0.3"
13+
TREADER_RELEASE="1.0.5"
1414
TEST_CHECK_RELEASE="0.10.0-alpha2"
1515

1616
# check dependencies

script/noderepljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [ "$CLOJURESCRIPT_HOME" = "" ]; then
55
fi
66

77
CLJSC_CP=''
8-
for next in lib/*: src/main/clojure: src/main/cljs: test/cljs; do
8+
for next in lib/*: src/main/clojure: src/main/cljs: src/test/cljs; do
99
CLJSC_CP=$CLJSC_CP$CLOJURESCRIPT_HOME'/'$next
1010
done
1111

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
(ns cljs.macro-test.cljs2261)
2+
3+
(defmacro cake []
4+
`(X.))
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(ns cljs.macro-test.cljs2261)
2+
3+
(defrecord X [])

src/test/self/self_host/test.cljs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,53 @@
11291129
(is (some? (re-find #"foo\.core\.global\$module\$calculator = goog.global.Calculator;\snull;" source)))
11301130
(inc! l)))))))
11311131

1132+
(deftest test-cljs-2261
1133+
(async done
1134+
(let [st (cljs/empty-state)
1135+
l (latch 2 done)]
1136+
(cljs/eval st '(ns bar.core2261a
1137+
(:require [foo.core2261a :refer-macros [cake]]))
1138+
{:ns 'cljs.user
1139+
:eval node-eval
1140+
:context :expr
1141+
:load (fn [{:keys [macros]} cb]
1142+
(if macros
1143+
(cb {:lang :clj
1144+
:source "(ns foo.core2261a) (defmacro cake [] `(->X))"})
1145+
(cb {:lang :clj
1146+
:source "(ns foo.core2261a) (defrecord X [])"})))}
1147+
(fn [{:keys [error]}]
1148+
(is (nil? error))
1149+
(cljs/eval-str st "(pr-str (cake))" nil
1150+
{:ns 'bar.core2261a
1151+
:eval node-eval
1152+
:context :expr}
1153+
(fn [{:keys [error value]}]
1154+
(is (nil? error))
1155+
(is (= "#foo.core2261a.X{}" value))
1156+
(inc! l)))))
1157+
(cljs/eval st '(ns bar.core2261b
1158+
(:require [foo.core2261b :refer-macros [cake]]))
1159+
{:ns 'cljs.user
1160+
:eval node-eval
1161+
:context :expr
1162+
:load (fn [{:keys [macros]} cb]
1163+
(if macros
1164+
(cb {:lang :clj
1165+
:source "(ns foo.core2261b) (defmacro cake [] `(X.))"})
1166+
(cb {:lang :clj
1167+
:source "(ns foo.core2261b) (defrecord X [])"})))}
1168+
(fn [{:keys [error]}]
1169+
(is (nil? error))
1170+
(cljs/eval-str st "(pr-str (cake))" nil
1171+
{:ns 'bar.core2261b
1172+
:eval node-eval
1173+
:context :expr}
1174+
(fn [{:keys [error value]}]
1175+
(is (nil? error))
1176+
(is (= "#foo.core2261b.X{}" value))
1177+
(inc! l))))))))
1178+
11321179
(defn -main [& args]
11331180
(run-tests))
11341181

0 commit comments

Comments
 (0)