mori icon indicating copy to clipboard operation
mori copied to clipboard

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

Open dmitrig01 opened this issue 9 years ago • 3 comments

> 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)

dmitrig01 avatar Dec 15 '15 21:12 dmitrig01

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

sesm avatar Dec 27 '15 20:12 sesm

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

jakecadams avatar Jan 18 '16 20:01 jakecadams

+1

carlos-wong avatar Apr 27 '16 10:04 carlos-wong