[CLJS-376] `case` doesn't match quoted symbols Created: 07/Sep/12 Updated: 07/Sep/12 Resolved: 07/Sep/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Shantanu Kumar | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | bug | ||
| Environment: |
ClojureScript |
||
| Description |
|
It works fine in the Clojure 1.4.0 REPL: user=> (let [a 'a] (case a nil :nil '& :amp :none)) :none user=> (let [a '&] (case a nil :nil '& :amp :none)) :amp user=> (let [a 'b] (case a nil :nil 'b :b :none)) :b But in the CLJS Rhino REPL this is what I see: ClojureScript:cljs.user> (let [a 'a] (case a nil :nil '& :amp :none)) :none ClojureScript:cljs.user> (let [a '&] (case a nil :nil '& :amp :none)) :none ClojureScript:cljs.user> (let [a 'b] (case a nil :nil 'b :b :none)) :none |
| Comments |
| Comment by David Nolen [ 07/Sep/12 4:48 PM ] |
|
This did reveal a bug though the ticket description does have a user error. The tests for case can only be literals - you should not quote the test values. For example the following is how symbols should be tested: (let [a '&] (case a nil :nil & :amp :none))
The above code that quotes the test is actually equivalent to: (let [a '&] (case a nil :nil (quote &) :amp :none))
Which happens to work but probably isn't intended. With the coming patch CLJS now works as Clojure. |
| Comment by David Nolen [ 07/Sep/12 4:49 PM ] |
|
Fixed, http://github.com/clojure/clojurescript/commit/c8e301a9b058f81bb599026a07f97ccdf4441730 |