Details
-
Type:
Defect
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Completed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:
-
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
Activity
David Nolen
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Resolution | Completed [ 1 ] | |
| Status | Open [ 1 ] | Resolved [ 5 ] |
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.
(let [a '&] (case a nil :nil & :amp :none))(let [a '&] (case a nil :nil (quote &) :amp :none))