(hash (symbol "/")) does not match (hash '/)

Description

(== (hash '/) (hash (symbol "/"))) ; returns false
Obviously we would expect the result to be true.

I believe that (symbol "/") is incorrectly treating the slash as the namespace/name separator.
I think that updating the condition at src/main/cljs/cljs/core.cljs:981 as follows might fix the bug:

(let [idx (.indexOf name "/")]

  • (if (== idx -1)
    + (if (> idx 0)
    (symbol nil name)

Alternatively, since this issue seems to be related to (resolved) in the Clojure compiler, a similar patch would probably also solve this issue:

(let [idx (.indexOf name "/")]

  • (if (== idx -1)
    + (if (or (== idx -1) (= name "/"))
    (symbol nil name)

Environment

None

Activity

Show:
Nick Vrvilo
February 22, 2016, 11:16 PM

symbol function fix + non-regression tests

Mike Fikes
February 25, 2016, 6:49 PM

I can confirm that this patch works for me. Specifically, in bootstrap, if you try to look in the compiler analysis cache for /, this patch fixes things for this case making this work:

and lots of things surrounding cljs.core// start to work, like doc, etc.

Mike Fikes
February 25, 2016, 6:54 PM

Hey Nick, have you signed the Clojure CA? (You don't appear to be listed http://clojure.org/community/contributors)

Nick Vrvilo
February 25, 2016, 7:12 PM

Hi Mike. I've received the confirmation email that my CA was successfully filed. My name should pop up on the list whenever it does a refresh. Thanks for confirming the patch!

David Nolen
February 26, 2016, 7:39 PM
Completed

Assignee

Unassigned

Reporter

Nick Vrvilo

Labels

Approval

None

Patch

Code and Test

Affects versions

Priority

Minor