Commit Graph

2 Commits

Author SHA1 Message Date
Julien Fischer
86a767095f Fix a bug in the C# implementation of array.shrink/3.
library/array.m:
   Workaround the fact that C#'s 'is' operator has some fairly surprising
   behaviour with arrays of integer types.

tests/hard_coded/array_primitives.{m,exp}:
tests/hard_coded/array_shrinks.{m,exp}:
   Improve the coverage of these tests.
2019-09-05 17:06:24 +10:00
Julien Fischer
71a78fa98c Fix problems with array.shrink/3.
The behaviour of array.shrink/3 was not defined if its first argument was
negative.  If this occurred, the C backends would return an empty array, while
the non-C backends would abort.  This diff changes the behaviour of shrink/3 so
that it throws an exception if its first argument is negative.

The implementation of shrink/3 for the Java backend did not handle the case
where the array's element type was represented by the one the following Java
primitive types: byte, short, long and float.  Handle those cases.

library/array.m:
   Make the above fixes.

   Fix a typo in my previous commit.

NEWS:
   Note the change in behaviour if the first argument of shrink/3 is
   negative.

tests/hard_coded/Mmakefile:
tests/hard_coded/array_shrink.{m,exp}:
   Add a test case.
2018-11-11 04:24:55 +00:00