Fix ClojureScript protocol dispatch in Cherry#166
Conversation
cb53b8a to
4022874
Compare
4022874 to
61b9a4a
Compare
|
Tests are incorrect and don't conform to test suite. Need to redo. |
61b9a4a to
f2555ff
Compare
|
Test suite reconforms. |
|
Similar remark here as in the assert PR |
f2555ff to
8e83915
Compare
|
Way simpler now. Just an externs file, adding it to shadow, and a new test under assert. |
8e83915 to
810a3e8
Compare
|
Branch now depends on #172 but changelog entry is in here as well. |
|
Do we really need the big externs file? Why didn't I need them for ISwap etc before? Does the externs file get used by downstream users of cherry (I don't believe so?) |
|
Hmm. Without the externs, the (correctly invoked) tests now fail at: FAIL in (protocol-dispatch-test) (cherry/compiler_test.cljs:552:9) |
|
Why does it work for ISwap etc then? |
|
The test re-passes with the new extern file removed, with just an addition of ICounted to externs/cherry.txt: cljs$core$ICounted$_count$arity$1. Will adjust to add the protocols in there |
810a3e8 to
35b2d00
Compare
|
Okay -- I added as many user-testable protocols as I could figure out, with notes about all the ones I had to skip either because they were esoterically internal or had no methods. I had to add protocol_mask$partition alongside the top-level cljs$core$IFoo$ to get the tests to work on about half of them. Re deftype.cljc, that removal is just fixing a duplication of IPrintWithWriter in the list that I noticed when expanding core-protocols. |
|
More broadly -- ICounted is the actual thing I'm hitting, but just slapping one additional protocol in felt like a bandaid, and since I saw the todo, I assumed that it'd be helpful to try to just go through all the protocols that are implementable. If you'd prefer for me to shrink it down to just ICounted and deal with the other ones later, that's totally appropriate too and I can shrink this down to just a few lines. |
35b2d00 to
44a2e19
Compare
Adds externs file to preserve protocol names in runtime and updates compiler to generate full protocol names with cljs.core namespace prefix.
Changes:
Fixes protocol dispatch between Cherry-compiled deftypes and ClojureScript runtime.
Please answer the following questions and leave the below in as part of your PR.
This PR corresponds to an issue with a clear problem statement.
Protocol dispatch fails for ClojureScript protocols in Cherry-compiled deftypes #165
This PR contains a test to prevent against future regressions
I have updated the CHANGELOG.md file with a description of the addressed issue.