Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling m.toClj on an object with key "uc" breaks #178

Open
dmitrig01 opened this issue Dec 15, 2015 · 3 comments
Open

Calling m.toClj on an object with key "uc" breaks #178

dmitrig01 opened this issue Dec 15, 2015 · 3 comments

Comments

@dmitrig01
Copy link

> m.toClj({ "uc1": "test" })
{"uc1" "test"}
> m.toClj({ "uc": "test" })
Error: No protocol method IEncodeClojure.-js->clj defined for type object: [object Object]
    at Error (<anonymous>)
    at x (/Users/dmitrig01/Documents/Projects/branch-backend/node_modules/mori/mori.js:17:63)
    at Nh (/Users/dmitrig01/Documents/Projects/branch-backend/node_modules/mori/mori.js:384:268)
    at v (/Users/dmitrig01/Documents/Projects/branch-backend/node_modules/mori/mori.js:385:425)
    at Function.b (/Users/dmitrig01/Documents/Projects/branch-backend/node_modules/mori/mori.js:387:109)
    at Function.a (/Users/dmitrig01/Documents/Projects/branch-backend/node_modules/mori/mori.js:385:42)
    at Object.b (/Users/dmitrig01/Documents/Projects/branch-backend/node_modules/mori/mori.js:422:95)
    at Object.c [as toClj] (/Users/dmitrig01/Documents/Projects/branch-backend/node_modules/mori/mori.js:422:168)
    at repl:1:4
    at REPLServer.self.eval (repl.js:110:21)
@sesm
Copy link

sesm commented Dec 27, 2015

Was able to reproduce this issue.
This is indeed very strange. Looking at js->clj source, it seems that the check (satisfies? IEncodeClojure x) returns true, when it shouldn't (https://github.com/clojure/clojurescript/blob/9391870fa12a680281b80f2335a7c3342a3c08cb/src/main/cljs/cljs/core.cljs#L9333)
It might be some weird minification issue. String "uc" appears in minified mori.js 40 times and is defined as a top-level function.
I've found one more string that gives weird result with m.toClj:

> m.toClj({ "tc": "test" })
Error: No protocol method IEmptyableCollection.-empty defined for type object: [object Object]
    at Error (<anonymous>)
    at x (/home/sega/Repos/mori-test/node_modules/mori/mori.js:17:63)
    at Na (/home/sega/Repos/mori-test/node_modules/mori/mori.js:19:96)
    at Oc (/home/sega/Repos/mori-test/node_modules/mori/mori.js:59:358)
    at v (/home/sega/Repos/mori-test/node_modules/mori/mori.js:385:474)
    at Function.b (/home/sega/Repos/mori-test/node_modules/mori/mori.js:387:109)
    at Function.a (/home/sega/Repos/mori-test/node_modules/mori/mori.js:385:42)
    at Object.b (/home/sega/Repos/mori-test/node_modules/mori/mori.js:422:95)
    at Object.c [as toClj] (/home/sega/Repos/mori-test/node_modules/mori/mori.js:422:168)
    at repl:1:4

@jakecadams
Copy link

@swannodette @sesm any recommendations on work arounds for this issue?

@carlos-wong
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants