We're updating the issue view to help you get more done. 

conditional reading bugs

Description

Bugs in conditional reading:

1 2 3 4 5 (ns bug) #?(:cljs {'a 1 'b 2}) #?(:cljs (let [{{b :b} :a {d :d} :c} {}]))

Requiring / loading this file at the REPL results in the following exception:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 CompilerException java.lang.IllegalArgumentException: Duplicate key: null, compiling: clojure.lang.Compiler.load (Compiler.java:7244) clojure.lang.RT.loadResourceScript (RT.java:371) clojure.lang.RT.loadResourceScript (RT.java:362) clojure.lang.RT.load (RT.java:446) clojure.lang.RT.load (RT.java:412) clojure.core/load/fn--5427 (core.clj:5862) clojure.core/load (core.clj:5861) clojure.core/load-one (core.clj:5667) clojure.core/load-lib/fn--5376 (core.clj:5707) clojure.core/load-lib (core.clj:5706) clojure.core/apply (core.clj:630) clojure.core/load-libs (core.clj:5745) Caused by: IllegalArgumentException Duplicate key: null clojure.lang.PersistentArrayMap.createWithCheck (PersistentArrayMap.java:70) clojure.lang.RT.map (RT.java:1537) clojure.lang.LispReader$MapReader.invoke (LispReader.java:1152) clojure.lang.LispReader.read (LispReader.java:255) clojure.lang.LispReader.access$800 (LispReader.java:40) clojure.lang.LispReader$ConditionalReader.readCondDelimited (LispReader.java:1376) clojure.lang.LispReader$ConditionalReader.invoke (LispReader.java:1448) clojure.lang.LispReader$DispatchReader.invoke (LispReader.java:684) clojure.lang.LispReader.read (LispReader.java:255) clojure.lang.LispReader.readDelimitedList (LispReader.java:1191) clojure.lang.LispReader$ListReader.invoke (LispReader.java:1040) clojure.lang.LispReader.read (LispReader.java:255)
1 2 3 4 (ns bug) (def m #?(:cljs ^{:a :b} {} :clj ^{:a :b} {}))
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 CompilerException java.lang.IllegalArgumentException: Metadata must be Symbol,Keyword,String or Map, compiling:(bug.cljc:3:25) clojure.lang.Compiler.load (Compiler.java:7244) clojure.lang.RT.loadResourceScript (RT.java:371) clojure.lang.RT.loadResourceScript (RT.java:362) clojure.lang.RT.load (RT.java:446) clojure.lang.RT.load (RT.java:412) clojure.core/load/fn--5427 (core.clj:5862) clojure.core/load (core.clj:5861) clojure.core/load-one (core.clj:5667) clojure.core/load-lib/fn--5376 (core.clj:5707) clojure.core/load-lib (core.clj:5706) clojure.core/apply (core.clj:630) clojure.core/load-libs (core.clj:5745) Caused by: IllegalArgumentException Metadata must be Symbol,Keyword,String or Map clojure.lang.LispReader$MetaReader.invoke (LispReader.java:790) clojure.lang.LispReader.read (LispReader.java:255) clojure.lang.LispReader.access$800 (LispReader.java:40) clojure.lang.LispReader$ConditionalReader.readCondDelimited (LispReader.java:1376) clojure.lang.LispReader$ConditionalReader.invoke (LispReader.java:1448) clojure.lang.LispReader$DispatchReader.invoke (LispReader.java:684) clojure.lang.LispReader.read (LispReader.java:255) clojure.lang.LispReader.readDelimitedList (LispReader.java:1191) clojure.lang.LispReader$ListReader.invoke (LispReader.java:1040) clojure.lang.LispReader.read (LispReader.java:255) clojure.lang.LispReader.read (LispReader.java:195) clojure.lang.Compiler.load (Compiler.java:7232)
1 2 3 (ns bug) #?(:cljs {:a #_:b :c})
1 CompilerException java.lang.RuntimeException: Map literal must contain an even number of forms

Cause: Not properly handling suppress-read flag.

Patch: 0001-CLJ-1698-fix-conditional-reading-bugs.patch

Environment

None

Status

Assignee

Unassigned

Reporter

David Nolen

Labels

Approval

Ok

Patch

Code and Test

Fix versions

Affects versions

Release 1.7

Priority

Major