Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007820OCamlstandard librarypublic2018-07-11 18:462018-07-11 19:17
Reporterthierry.martinez 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version4.07.0 
Target VersionFixed in Version4.07.1+dev 
Summary0007820: Array.of_seq applies a circular permutation of one cell to the right on the sequence
DescriptionWith OCaml 4.07.0 and trunk, we have

# Array.of_seq (Array.to_seq [| 1; 2; 3 |]);;
- : int array = [|3; 1; 2|]

In stdlib/array.ml, line 337 (last line of of_rev_list), we have
      fill (len-1) tl
whereas it should be
      fill (len-2) tl
since hd, which should be assigned to the cell (len - 1), is skipped.
Steps To ReproduceRun the top-level and execute the following line

# Array.of_seq (Array.to_seq [| 1; 2; 3 |]);;
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0019235)
gasche (administrator)
2018-07-11 18:52

Now might be time to repeat my proposition to ask for unit tests for new stdlib functions. In my Batteries experience, this helps a lot for development (quickcheck-style tests help even more).
(0019236)
thierry.martinez (reporter)
2018-07-11 18:55

Even if it is sadly too late, I just proposed a regression test in https://github.com/ocaml/ocaml/pull/1897 [^]
(0019237)
frisch (developer)
2018-07-11 19:04

Adding more test was actually discussed on https://github.com/ocaml/ocaml/pull/1002 [^] , but left as future work. Perhaps I should have been stricter and waited for those tests before merging.
(0019238)
xleroy (administrator)
2018-07-11 19:17

Thanks for the fix. Merged in trunk and in 4.07 branch.

- Issue History
Date Modified Username Field Change
2018-07-11 18:46 thierry.martinez New Issue
2018-07-11 18:52 gasche Note Added: 0019235
2018-07-11 18:55 thierry.martinez Note Added: 0019236
2018-07-11 19:04 frisch Note Added: 0019237
2018-07-11 19:17 xleroy Note Added: 0019238
2018-07-11 19:17 xleroy Status new => resolved
2018-07-11 19:17 xleroy Resolution open => fixed
2018-07-11 19:17 xleroy Fixed in Version => 4.07.1+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker