Details
-
Type:
Defect
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:1.7.0-08, OS X 10.8
-
Patch:Code and Test
-
Approval:Vetted
Description
I could reproduce on current 10/05 git.
Reduce doesn't work on subvecs of primitive vectors.
Root cause seems to be that RT/subvec and APersistentVector$SubVector make assumptions about implementation
If reduce on a subvec doesn't work then neither will nice ops like fold.
How to cause:
(let [prim-vec (into (vector-of :long) (range 10000))]
(reduce + (subvec prim-vec 1 500)))
->> ClassCastException clojure.core.Vec cannot be cast to clojure.lang.PersistentVector clojure.lang.APersistentVector$SubVector.iterator (APersistentVector.java:523)
Mike, your patch clj-1082.patch applies cleanly to latest master for me, so looks like you found one way to do it.
Another would be as follows, and closer to the directions on the JIRA workflow page: http://dev.clojure.org/display/design/JIRA+workflow (but not identical). Note that these commands would work on Mac OS X or Linux. I'm not sure what the correct corresponding command would be on Windows for the "git am" step below, unless that just happens to work because Windows and/or git implement the input redirection with "<" somehow.
$ git clone git://github.com/clojure/clojure.git
$ cd clojure
$ git am --keep-cr -s < clj-1076-fix-tests-on-windows-patch-v1.txt
$ git checkout -b fix-clj-1082
$ git commit -a -m "fixed annoying bug, refs #42"
From there on down it is the same as the instructions on the JIRA workflow page. The "git format-patch master --stdout > file.patch" will create a patch for the changes you have made in the current branch fix-clj-1082 starting from the master branch, which has the CLJ-1076 fix because of the 'git am' command above.
- After editing to make your changes, commit them to the current fix-clj-1082 branch
$ git commit -a -m "fixed annoying bug, refs #42"
From there on down it is the same as the instructions on the JIRA workflow page. The "git format-patch master --stdout > file.patch" will create a patch for the changes you have made in the current branch fix-clj-1082 starting from the master branch, which has the CLJ-1076 fix because of the 'git am' command above.