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

Unification error #30

Closed
ggeoffrey opened this issue Sep 11, 2021 · 2 comments
Closed

Unification error #30

ggeoffrey opened this issue Sep 11, 2021 · 2 comments
Labels

Comments

@ggeoffrey
Copy link
Member

Impacts the master branch.

@witek 2:11 PM
Hi. I discovered strange behavior using rcf in my shadow-cljs app.

(tests "mytest" "x" := "y")

yields this error in the browser console:

react_devtools_backend.js:4049 mytest
react_devtools_backend.js:4049   actual:
react_devtools_backend.js:4049 RangeError: Maximum call stack size exceeded
    at Object.eval [as cljs$core$ILookup$_lookup$arity$3] (core.cljs:9183)
    at Object.eval [as cljs$core$ILookup$_lookup$arity$2] (core.cljs:9250)
    at Object.eval [as cljs$core$IFn$_invoke$arity$1] (core.cljs:9262)
    at Object.hyperfiddle$rcf$unify$wildcard_QMARK_ [as wildcard_QMARK_] (unify.cljc:60)
    at Function.eval [as cljs$core$IFn$_invoke$arity$5] (unify.cljc:76)
    at Function.eval [as cljs$core$IFn$_invoke$arity$5] (unify.cljc:82)
    at Function.eval [as cljs$core$IFn$_invoke$arity$5] (unify.cljc:82)
    at Function.eval [as cljs$core$IFn$_invoke$arity$5] (unify.cljc:82)
    at Function.eval [as cljs$core$IFn$_invoke$arity$5] (unify.cljc:82)
    at Function.eval [as cljs$core$IFn$_invoke$arity$5] (unify.cljc:82)
overrideMethod @ react_devtools_backend.js:4049
eval @ reporters.cljs:43
eval @ core.cljs:11198
eval @ core.cljs:11184
cljs$test$do_report @ test.cljs:425
eval @ utils.cljs:286
eval @ test.cljs:476
cljs$test$run_block @ test.cljs:448
cljs$test$test_var @ test.cljs:500
spark$utils$RCF__spark_utils__286 @ utils.cljs:286
eval @ utils.cljs:286
goog.globalEval @ main.js:486
shadow$cljs$devtools$client$browser$script_eval @ browser.cljs:24
shadow$cljs$devtools$client$browser$do_js_load @ browser.cljs:36
eval @ browser.cljs:57
eval @ env.cljs:248
shadow$cljs$devtools$client$env$do_js_reload_STAR_ @ env.cljs:220
eval @ env.cljs:256
shadow$cljs$devtools$client$browser$do_js_reload @ browser.cljs:43
eval @ browser.cljs:93
eval @ shared.cljs:32
shadow$remote$runtime$shared$process @ shared.cljc:164
eval @ shared.cljs:289
shadow$cljs$devtools$client$shared$remote_msg @ shared.cljs:16
eval @ websocket.cljs:16
react_devtools_backend.js:4049 expected: (hyperfiddle.rcf/unifies? := "x" "y")
@ggeoffrey ggeoffrey added the cljs label Sep 11, 2021
@ggeoffrey
Copy link
Member Author

I could reproduce a similar issue compiling to the node-test target:

🔥example.cljc:55:1
  mytest
    actual:
  RangeError: Maximum call stack size exceeded
      at Object.hyperfiddle$rcf$unify$ignore_variable_QMARK_ [as ignore_variable_QMARK_] (/Users/geoffrey/Documents/hyperfiddle/fabric/vendor/rcf/.shadow-cljs/builds/test/dev/out/cljs-runtime/hyperfiddle/rcf/unify.cljc:16:1)
      at hyperfiddle$rcf$unify$lvar_QMARK_ (/Users/geoffrey/Documents/hyperfiddle/fabric/vendor/rcf/.shadow-cljs/builds/test/dev/out/cljs-runtime/hyperfiddle/rcf/unify.cljc:20:1)
      at Function.cljs$core$IFn$_invoke$arity$5 (/Users/geoffrey/Documents/hyperfiddle/fabric/vendor/rcf/.shadow-cljs/builds/test/dev/out/cljs-runtime/hyperfiddle/rcf/unify.cljc:71:6)
      at Function.cljs$core$IFn$_invoke$arity$5 (/Users/geoffrey/Documents/hyperfiddle/fabric/vendor/rcf/.shadow-cljs/builds/test/dev/out/cljs-runtime/hyperfiddle/rcf/unify.cljc:78:33)
      at Function.cljs$core$IFn$_invoke$arity$5 (/Users/geoffrey/Documents/hyperfiddle/fabric/vendor/rcf/.shadow-cljs/builds/test/dev/out/cljs-runtime/hyperfiddle/rcf/unify.cljc:78:33)
      at Function.cljs$core$IFn$_invoke$arity$5 (/Users/geoffrey/Documents/hyperfiddle/fabric/vendor/rcf/.shadow-cljs/builds/test/dev/out/cljs-runtime/hyperfiddle/rcf/unify.cljc:78:33)
      at Function.cljs$core$IFn$_invoke$arity$5 (/Users/geoffrey/Documents/hyperfiddle/fabric/vendor/rcf/.shadow-cljs/builds/test/dev/out/cljs-runtime/hyperfiddle/rcf/unify.cljc:78:33)
      at Function.cljs$core$IFn$_invoke$arity$5 (/Users/geoffrey/Documents/hyperfiddle/fabric/vendor/rcf/.shadow-cljs/builds/test/dev/out/cljs-runtime/hyperfiddle/rcf/unify.cljc:78:33)
      at Function.cljs$core$IFn$_invoke$arity$5 (/Users/geoffrey/Documents/hyperfiddle/fabric/vendor/rcf/.shadow-cljs/builds/test/dev/out/cljs-runtime/hyperfiddle/rcf/unify.cljc:78:33)
      at Function.cljs$core$IFn$_invoke$arity$5 (/Users/geoffrey/Documents/hyperfiddle/fabric/vendor/rcf/.shadow-cljs/builds/test/dev/out/cljs-runtime/hyperfiddle/rcf/unify.cljc:78:33)
  expected: (hyperfiddle.rcf/unifies? := "x" "y")

Only ClojureScript is impacted.

@ggeoffrey
Copy link
Member Author

Unification will recurse on composite values. Collections and strings are examples of composite values. In Clojure, strings are made of chars (first "str") := \s, but JavaScript doesn’t have chars. So strings are made of strings of size 1.

"a"[0] := 'a'
"a"[0][0]  := StackOverflow 

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

No branches or pull requests

1 participant