[CTYP-142] Support a Path Element for first/second/nth Created: 11/May/14 Updated: 08/Jun/14 Resolved: 08/Jun/14
|Reporter:||Jake Goulding||Assignee:||Jake Goulding|
What I tried:
I expected this to type-check. Instead, I got:
I could understand core.typed thinking it could be `nil` if it looked at both members of the union, but it is very strange to me that it thinks the second item in the vector could be :params or :no-params, as those should only occur in the first position...
(With version 0.2.45-20140511.165157-12)
|Comment by Jake Goulding [ 11/May/14 7:08 PM ]|
It's actually the same for heterogenous maps as well:
|Comment by Jake Goulding [ 11/May/14 7:14 PM ]|
Perhaps this isn't something that's possible right now? As a human, I know that (:op stmt) can only take one of two values, each of which uniquely picks between the union values. I think this would involve changing variable stmt based on information from key, which I have yet to find in the source code.
|Comment by Ambrose Bonnaire-Sergeant [ 12/May/14 1:34 AM ]|
I don't expect the HVec case to work yet.
I explain how it might be implemented from [12:01:38] http://logs.lazybot.org/irc.freenode.net/%23typed-clojure/2014-05-11.txt
The HMap case also fails for me. Looks like core.typed is sensitive to order or something, because rearranging it like this checks fine:
|Comment by Jake Goulding [ 31/May/14 5:33 PM ]|
Added a patch with some initial refactoring to cleanup the implementation of check.nth. Useful implementation is still being worked on.
|Comment by Ambrose Bonnaire-Sergeant [ 08/Jun/14 3:02 PM ]|
Merged. I also made the overlap case more accurate: https://github.com/clojure/core.typed/commit/623bfe0918036ea8aa1f5496e268d8b1dfdf0db5