ClojureScript

Incorrect handling of out-of-bounds indices in vectors and subvectors

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code and Test

Description

1. ClojureScript vectors currently return nil when invoked as a function with an out-of-bounds index. In Clojure, they throw.

2. ClojureScript's Subvec currently allows index to the underlying vector outside of the subvec bounds. In Clojure, APersistentVector$SubVector performs a bounds check.

Fully fixing 1. requires a fix for 2., so I'm submitting this as one issue.

Activity

Hide
Michał Marczyk added a comment -

Fixes + tests.

Also factors out throwing on index-out-of-bounds into a new vector-index-out-of-bounds private function.

Show
Michał Marczyk added a comment - Fixes + tests. Also factors out throwing on index-out-of-bounds into a new vector-index-out-of-bounds private function.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: