subvec function not behaving consitently with invalid subranges


  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Environment:
    Ubuntu precise 64 bits, Mac OS X Lion
  • Patch:
    Code and Test


When using the subvec function with a as a parameter vector and a range that is not in the original vector, the function returns a value:

(subvec [1 2 3] 0 4) => [1 2 3 nil]

However, when using with seqs, it works as it supposed to:

(subvec (range 3) 0 4) => ERROR: Index out of bounds

This is because the validation of ranges is not happening at build time of the subvec type, this bug contains a patch that adds a new private `build-subvec` function into cljs.core.

  1. cljs_subvec_revised.patch
    23/Nov/12 3:09 PM
    4 kB
    Roman Gonzalez
  2. cljs_subvec_revised1.patch
    23/Nov/12 3:18 PM
    4 kB
    Roman Gonzalez
  3. cljs_subvec.patch
    22/Nov/12 5:05 PM
    4 kB
    Roman Gonzalez



Vote (0)
Watch (1)


  • Created: