[m-rev.] diff: fix array insts

Simon Taylor staylr at gmail.com
Sat Feb 24 21:32:51 AEDT 2007


Estimated hours taken: 0.5
Branches: main

library/array.m:
library/array2d.m:
library/svarray.m:
	Remove the bogus `array' constructor from the insts for arrays.
	Comment out mode declarations that are now duplicates.

tests/hard_coded/Mmakefile:
tests/hard_coded/array_test.{m,exp}:
	Test case.

Index: library/array.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/array.m,v
retrieving revision 1.152
diff -u -u -r1.152 array.m
--- library/array.m	1 Feb 2007 01:34:19 -0000	1.152
+++ library/array.m	16 Feb 2007 04:34:23 -0000
@@ -67,29 +67,26 @@
 
 :- type array(T).
 
-:- inst array(I) == bound(array(I)).
+:- inst array(I) == ground.
 :- inst array == array(ground).
-:- inst array_skel == array(free).
 
     % XXX the current Mercury compiler doesn't support `ui' modes,
     % so to work-around that problem, we currently don't use
     % unique modes in this module.
 
-% :- inst uniq_array(I) == unique(array(I)).
+% :- inst uniq_array(I) == unique.
 % :- inst uniq_array == uniq_array(unique).
-:- inst uniq_array(I) == bound(array(I)). % XXX work-around
-:- inst uniq_array == uniq_array(ground). % XXX work-around
-:- inst uniq_array_skel == uniq_array(free).
+:- inst uniq_array(I) == array(I).          % XXX work-around
+:- inst uniq_array == uniq_array(ground).   % XXX work-around
 
 :- mode array_di == di(uniq_array).
 :- mode array_uo == out(uniq_array).
 :- mode array_ui == in(uniq_array).
 
-% :- inst mostly_uniq_array(I) == mostly_unique(array(I)).
+% :- inst mostly_uniq_array(I) == mostly_unique).
 % :- inst mostly_uniq_array == mostly_uniq_array(mostly_unique).
-:- inst mostly_uniq_array(I) == bound(array(I)).    % XXX work-around
+:- inst mostly_uniq_array(I) == array(I).    % XXX work-around
 :- inst mostly_uniq_array == mostly_uniq_array(ground). % XXX work-around
-:- inst mostly_uniq_array_skel == mostly_uniq_array(free).
 
 :- mode array_mdi == mdi(mostly_uniq_array).
 :- mode array_muo == out(mostly_uniq_array).
@@ -133,53 +130,53 @@
     % Note: in this implementation, the lower bound is always zero.
     %
 :- pred array.min(array(_T), int).
-:- mode array.min(array_ui, out) is det.
+%:- mode array.min(array_ui, out) is det.
 :- mode array.min(in, out) is det.
 
 :- func array.min(array(_T)) = int.
-:- mode array.min(array_ui) = out is det.
+%:- mode array.min(array_ui) = out is det.
 :- mode array.min(in) = out is det.
 
 :- func array.least_index(array(T)) = int.
-:- mode array.least_index(array_ui) = out is det.
+%:- mode array.least_index(array_ui) = out is det.
 :- mode array.least_index(in) = out is det.
 
     % array.max returns the upper bound of the array.
     %
 :- pred array.max(array(_T), int).
-:- mode array.max(array_ui, out) is det.
+%:- mode array.max(array_ui, out) is det.
 :- mode array.max(in, out) is det.
 
 :- func array.max(array(_T)) = int.
-:- mode array.max(array_ui) = out is det.
+%:- mode array.max(array_ui) = out is det.
 :- mode array.max(in) = out is det.
 
 :- func array.greatest_index(array(T)) = int.
-:- mode array.greatest_index(array_ui) = out is det.
+%:- mode array.greatest_index(array_ui) = out is det.
 :- mode array.greatest_index(in) = out is det.
 
     % array.size returns the length of the array,
     % i.e. upper bound - lower bound + 1.
     %
 :- pred array.size(array(_T), int).
-:- mode array.size(array_ui, out) is det.
+%:- mode array.size(array_ui, out) is det.
 :- mode array.size(in, out) is det.
 
 :- func array.size(array(_T)) = int.
-:- mode array.size(array_ui) = out is det.
+%:- mode array.size(array_ui) = out is det.
 :- mode array.size(in) = out is det.
 
     % array.bounds returns the upper and lower bounds of an array.
     % Note: in this implementation, the lower bound is always zero.
     %
 :- pred array.bounds(array(_T), int, int).
-:- mode array.bounds(array_ui, out, out) is det.
+%:- mode array.bounds(array_ui, out, out) is det.
 :- mode array.bounds(in, out, out) is det.
 
     % array.in_bounds checks whether an index is in the bounds of an array.
     %
 :- pred array.in_bounds(array(_T), int).
-:- mode array.in_bounds(array_ui, in) is semidet.
+%:- mode array.in_bounds(array_ui, in) is semidet.
 :- mode array.in_bounds(in, in) is semidet.
 
 %-----------------------------------------------------------------------------%
@@ -188,18 +185,18 @@
     % Throws an exception if the index is out of bounds.
     %
 :- pred array.lookup(array(T), int, T).
-:- mode array.lookup(array_ui, in, out) is det.
+%:- mode array.lookup(array_ui, in, out) is det.
 :- mode array.lookup(in, in, out) is det.
 
 :- func array.lookup(array(T), int) = T.
-:- mode array.lookup(array_ui, in) = out is det.
+%:- mode array.lookup(array_ui, in) = out is det.
 :- mode array.lookup(in, in) = out is det.
 
     % array.semidet_lookup returns the Nth element of an array.
     % It fails if the index is out of bounds.
     %
 :- pred array.semidet_lookup(array(T), int, T).
-:- mode array.semidet_lookup(array_ui, in, out) is semidet.
+%:- mode array.semidet_lookup(array_ui, in, out) is semidet.
 :- mode array.semidet_lookup(in, in, out) is semidet.
 
     % array.set sets the nth element of an array, and returns the
@@ -224,11 +221,11 @@
     % It is an error if the index is out of bounds.
     %
 :- pred array.slow_set(array(T), int, T, array(T)).
-:- mode array.slow_set(array_ui, in, in, array_uo) is det.
+%:- mode array.slow_set(array_ui, in, in, array_uo) is det.
 :- mode array.slow_set(in, in, in, array_uo) is det.
 
 :- func array.slow_set(array(T), int, T) = array(T).
-:- mode array.slow_set(array_ui, in, in) = array_uo is det.
+%:- mode array.slow_set(array_ui, in, in) = array_uo is det.
 :- mode array.slow_set(in, in, in) = array_uo is det.
 
     % array.semidet_slow_set sets the nth element of an array, and returns
@@ -237,14 +234,14 @@
     % It fails if the index is out of bounds.
     %
 :- pred array.semidet_slow_set(array(T), int, T, array(T)).
-:- mode array.semidet_slow_set(array_ui, in, in, array_uo) is semidet.
+%:- mode array.semidet_slow_set(array_ui, in, in, array_uo) is semidet.
 :- mode array.semidet_slow_set(in, in, in, array_uo) is semidet.
 
     % Field selection for arrays.
     % Array ^ elem(Index) = array.lookup(Array, Index).
     %
 :- func array.elem(int, array(T)) = T.
-:- mode array.elem(in, array_ui) = out is det.
+%:- mode array.elem(in, array_ui) = out is det.
 :- mode array.elem(in, in) = out is det.
 
     % Field update for arrays.
@@ -259,11 +256,11 @@
     % Makes a new unique copy of an array.
     %
 :- pred array.copy(array(T), array(T)).
-:- mode array.copy(array_ui, array_uo) is det.
+%:- mode array.copy(array_ui, array_uo) is det.
 :- mode array.copy(in, array_uo) is det.
 
 :- func array.copy(array(T)) = array(T).
-:- mode array.copy(array_ui) = array_uo is det.
+%:- mode array.copy(array_ui) = array_uo is det.
 :- mode array.copy(in) = array_uo is det.
 
     % array.resize(Array0, Size, Init, Array):
@@ -299,11 +296,11 @@
     % of the array in the same order that they occurred in the array.
     %
 :- pred array.to_list(array(T), list(T)).
-:- mode array.to_list(array_ui, out) is det.
+%:- mode array.to_list(array_ui, out) is det.
 :- mode array.to_list(in, out) is det.
 
 :- func array.to_list(array(T)) = list(T).
-:- mode array.to_list(array_ui) = out is det.
+%:- mode array.to_list(array_ui) = out is det.
 :- mode array.to_list(in) = out is det.
 
     % array.fetch_items takes an array and a lower and upper index,
@@ -314,7 +311,7 @@
 :- mode array.fetch_items(in, in, in, out) is det.
 
 :- func array.fetch_items(array(T), int, int) = list(T).
-:- mode array.fetch_items(array_ui, in, in) = out is det.
+%:- mode array.fetch_items(array_ui, in, in) = out is det.
 :- mode array.fetch_items(in, in, in) = out is det.
 
     % array.bsearch takes an array, an element to be matched and a comparison
@@ -324,11 +321,11 @@
     % Fails if the element is not present.
     %
 :- pred array.bsearch(array(T), T, comparison_pred(T), maybe(int)).
-:- mode array.bsearch(array_ui, in, in(comparison_pred), out) is det.
+%:- mode array.bsearch(array_ui, in, in(comparison_pred), out) is det.
 :- mode array.bsearch(in, in, in(comparison_pred), out) is det.
 
 :- func array.bsearch(array(T), T, comparison_func(T)) = maybe(int).
-:- mode array.bsearch(array_ui, in, in(comparison_func)) = out is det.
+%:- mode array.bsearch(array_ui, in, in(comparison_func)) = out is det.
 :- mode array.bsearch(in, in, in(comparison_func)) = out is det.
 
     % array.map(Closure, OldArray, NewArray) applies `Closure' to
@@ -360,9 +357,9 @@
     % but more efficient.
     %
 :- func array.foldl(func(T1, T2) = T2, array(T1), T2) = T2.
-:- mode array.foldl(func(in, in) = out is det, array_ui, in) = out is det.
+%:- mode array.foldl(func(in, in) = out is det, array_ui, in) = out is det.
 :- mode array.foldl(func(in, in) = out is det, in, in) = out is det.
-:- mode array.foldl(func(in, di) = uo is det, array_ui, di) = uo is det.
+%:- mode array.foldl(func(in, di) = uo is det, array_ui, di) = uo is det.
 :- mode array.foldl(func(in, di) = uo is det, in, di) = uo is det.
 
     % array.foldr(Fn, Array, X) is equivalent to
@@ -370,9 +367,9 @@
     % but more efficient.
     %
 :- func array.foldr(func(T1, T2) = T2, array(T1), T2) = T2.
-:- mode array.foldr(func(in, in) = out is det, array_ui, in) = out is det.
+%:- mode array.foldr(func(in, in) = out is det, array_ui, in) = out is det.
 :- mode array.foldr(func(in, in) = out is det, in, in) = out is det.
-:- mode array.foldr(func(in, di) = uo is det, array_ui, di) = uo is det.
+%:- mode array.foldr(func(in, di) = uo is det, array_ui, di) = uo is det.
 :- mode array.foldr(func(in, di) = uo is det, in, di) = uo is det.
 
     % array.random_permutation(A0, A, RS0, RS) permutes the elements in
@@ -642,14 +639,6 @@
 %-----------------------------------------------------------------------------%
 
 :- pragma foreign_proc("C",
-    array.min(Array::array_ui, Min::out),
-    [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
-"
-    /* Array not used */
-    Min = 0;
-").
-:- pragma foreign_proc("C",
     array.min(Array::in, Min::out),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
         does_not_affect_liveness],
@@ -659,13 +648,6 @@
 ").
 
 :- pragma foreign_proc("C#",
-    array.min(Array::array_ui, Min::out),
-    [will_not_call_mercury, promise_pure, thread_safe],
-"
-    /* Array not used */
-    Min = 0;
-").
-:- pragma foreign_proc("C#",
     array.min(Array::in, Min::out),
     [will_not_call_mercury, promise_pure, thread_safe],
 "
@@ -674,13 +656,6 @@
 ").
 
 :- pragma foreign_proc("Java",
-    array.min(_Array::array_ui, Min::out),
-    [will_not_call_mercury, promise_pure, thread_safe],
-"
-    /* Array not used */
-    Min = 0;
-").
-:- pragma foreign_proc("Java",
     array.min(_Array::in, Min::out),
     [will_not_call_mercury, promise_pure, thread_safe],
 "
@@ -689,13 +664,6 @@
 ").
 
 :- pragma foreign_proc("C",
-    array.max(Array::array_ui, Max::out),
-    [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
-"
-    Max = Array->size - 1;
-").
-:- pragma foreign_proc("C",
     array.max(Array::in, Max::out),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
         does_not_affect_liveness],
@@ -703,16 +671,6 @@
     Max = Array->size - 1;
 ").
 :- pragma foreign_proc("C#",
-    array.max(Array::array_ui, Max::out),
-    [will_not_call_mercury, promise_pure, thread_safe],
-"
-    if (Array != null) {
-        Max = Array.Length - 1;
-    } else {
-        Max = -1;
-    }
-").
-:- pragma foreign_proc("C#",
     array.max(Array::in, Max::out),
     [will_not_call_mercury, promise_pure, thread_safe],
 "
@@ -724,16 +682,6 @@
 ").
 
 :- pragma foreign_proc("Java",
-    array.max(Array::array_ui, Max::out),
-    [will_not_call_mercury, promise_pure, thread_safe],
-"
-    if (Array != null) {
-        Max = java.lang.reflect.Array.getLength(Array) - 1;
-    } else {
-        Max = -1;
-    }
-").
-:- pragma foreign_proc("Java",
     array.max(Array::in, Max::out),
     [will_not_call_mercury, promise_pure, thread_safe],
 "
@@ -751,13 +699,6 @@
 %-----------------------------------------------------------------------------%
 
 :- pragma foreign_proc("C",
-    array.size(Array::array_ui, Max::out),
-    [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
-"
-    Max = Array->size;
-").
-:- pragma foreign_proc("C",
     array.size(Array::in, Max::out),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
         does_not_affect_liveness],
@@ -766,16 +707,6 @@
 ").
 
 :- pragma foreign_proc("C#",
-    array.size(Array::array_ui, Max::out),
-    [will_not_call_mercury, promise_pure, thread_safe],
-"
-    if (Array != null) {
-        Max = Array.Length;
-    } else {
-        Max = 0;
-    }
-").
-:- pragma foreign_proc("C#",
     array.size(Array::in, Max::out),
     [will_not_call_mercury, promise_pure, thread_safe],
 "
@@ -787,16 +718,6 @@
 ").
 
 :- pragma foreign_proc("Java",
-    array.size(Array::array_ui, Max::out),
-    [will_not_call_mercury, promise_pure, thread_safe],
-"
-    if (Array != null) {
-        Max = java.lang.reflect.Array.getLength(Array);
-    } else {
-        Max = 0;
-    }
-").
-:- pragma foreign_proc("Java",
     array.size(Array::in, Max::out),
     [will_not_call_mercury, promise_pure, thread_safe],
 "
@@ -848,17 +769,10 @@
     ).
 
 :- pred array.unsafe_lookup(array(T), int, T).
-:- mode array.unsafe_lookup(array_ui, in, out) is det.
+%:- mode array.unsafe_lookup(array_ui, in, out) is det.
 :- mode array.unsafe_lookup(in, in, out) is det.
 
 :- pragma foreign_proc("C",
-    array.unsafe_lookup(Array::array_ui, Index::in, Item::out),
-    [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
-"
-    Item = Array->elements[Index];
-").
-:- pragma foreign_proc("C",
     array.unsafe_lookup(Array::in, Index::in, Item::out),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
         does_not_affect_liveness],
@@ -867,12 +781,6 @@
 ").
 
 :- pragma foreign_proc("C#",
-    array.unsafe_lookup(Array::array_ui, Index::in, Item::out),
-    [will_not_call_mercury, promise_pure, thread_safe],
-"{
-    Item = Array.GetValue(Index);
-}").
-:- pragma foreign_proc("C#",
     array.unsafe_lookup(Array::in, Index::in, Item::out),
     [will_not_call_mercury, promise_pure, thread_safe],
 "{
@@ -880,12 +788,6 @@
 }").
 
 :- pragma foreign_proc("Java",
-    array.unsafe_lookup(Array::array_ui, Index::in, Item::out),
-    [will_not_call_mercury, promise_pure, thread_safe],
-"
-    Item = java.lang.reflect.Array.get(Array, Index);
-").
-:- pragma foreign_proc("Java",
     array.unsafe_lookup(Array::in, Index::in, Item::out),
     [will_not_call_mercury, promise_pure, thread_safe],
 "
@@ -1162,15 +1064,6 @@
 ").
 
 :- pragma foreign_proc("C",
-    array.copy(Array0::array_ui, Array::array_uo),
-    [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
-        does_not_affect_liveness],
-"
-    ML_alloc_array(Array, Array0->size + 1, MR_PROC_LABEL);
-    ML_copy_array(Array, (MR_ConstArrayPtr) Array0);
-").
-
-:- pragma foreign_proc("C",
     array.copy(Array0::in, Array::array_uo),
     [will_not_call_mercury, promise_pure, thread_safe, will_not_modify_trail,
         does_not_affect_liveness],
@@ -1180,17 +1073,6 @@
 ").
 
 :- pragma foreign_proc("C#",
-    array.copy(Array0::array_ui, Array::array_uo),
-    [will_not_call_mercury, promise_pure, thread_safe],
-"
-    // XXX we implement the same as ML_copy_array, which doesn't appear
-    // to deep copy the array elements
-    Array = System.Array.CreateInstance(Array0.GetType().GetElementType(),
-        Array0.Length);
-    System.Array.Copy(Array0, Array, Array0.Length);
-").
-
-:- pragma foreign_proc("C#",
     array.copy(Array0::in, Array::array_uo),
     [will_not_call_mercury, promise_pure, thread_safe],
 "
@@ -1202,23 +1084,6 @@
 ").
 
 :- pragma foreign_proc("Java",
-    array.copy(Array0::array_ui, Array::array_uo),
-    [will_not_call_mercury, promise_pure, thread_safe],
-"
-    if (Array0 == null) {
-        Array = null;
-    } else {
-        java.lang.Class itemClass =
-            java.lang.reflect.Array.get(Array0, 0).getClass();
-        int length = java.lang.reflect.Array.getLength(Array0);
-        Array = java.lang.reflect.Array.newInstance(itemClass, length);
-        for (int i = 0; i < length; i++) {
-            java.lang.reflect.Array.set(Array, i,
-                java.lang.reflect.Array.get(Array0, i));
-        }
-    }
-").
-:- pragma foreign_proc("Java",
     array.copy(Array0::in, Array::array_uo),
     [will_not_call_mercury, promise_pure, thread_safe],
 "
@@ -1459,9 +1324,9 @@
     foldl_0(Fn, A, X, array.min(A), array.max(A)).
 
 :- func foldl_0(func(T1, T2) = T2, array(T1), T2, int, int) = T2.
-:- mode foldl_0(func(in, in) = out is det, array_ui, in, in, in) = out is det.
+%:- mode foldl_0(func(in, in) = out is det, array_ui, in, in, in) = out is det.
 :- mode foldl_0(func(in, in) = out is det, in, in, in, in) = out is det.
-:- mode foldl_0(func(in, di) = uo is det, array_ui, di, in, in) = uo is det.
+%:- mode foldl_0(func(in, di) = uo is det, array_ui, di, in, in) = uo is det.
 :- mode foldl_0(func(in, di) = uo is det, in, di, in, in) = uo is det.
 
 foldl_0(Fn, A, X, I, Max) =
@@ -1477,9 +1342,9 @@
     foldr_0(Fn, A, X, array.min(A), array.max(A)).
 
 :- func foldr_0(func(T1, T2) = T2, array(T1), T2, int, int) = T2.
-:- mode foldr_0(func(in, in) = out is det, array_ui, in, in, in) = out is det.
+%:- mode foldr_0(func(in, in) = out is det, array_ui, in, in, in) = out is det.
 :- mode foldr_0(func(in, in) = out is det, in, in, in, in) = out is det.
-:- mode foldr_0(func(in, di) = uo is det, array_ui, di, in, in) = uo is det.
+%:- mode foldr_0(func(in, di) = uo is det, array_ui, di, in, in) = uo is det.
 :- mode foldr_0(func(in, di) = uo is det, in, di, in, in) = uo is det.
 
 foldr_0(Fn, A, X, Min, I) =
@@ -1680,7 +1545,7 @@
 
     % throw an exception indicating an array bounds error
 :- pred out_of_bounds_error(array(T), int, string).
-:- mode out_of_bounds_error(array_ui, in, in) is erroneous.
+%:- mode out_of_bounds_error(array_ui, in, in) is erroneous.
 :- mode out_of_bounds_error(in, in, in) is erroneous.
 
 out_of_bounds_error(Array, Index, PredName) :-
Index: library/array2d.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/array2d.m,v
retrieving revision 1.9
diff -u -u -r1.9 array2d.m
--- library/array2d.m	27 Sep 2006 06:16:37 -0000	1.9
+++ library/array2d.m	16 Feb 2007 05:15:20 -0000
@@ -65,14 +65,14 @@
     % An exception is thrown unless 0 =< I < M, 0 =< J < N.
     %
 :- func array2d(T) ^ elem(int, int) = T.
-:- mode array2d_ui ^ elem(in,  in ) = out is det.
+%:- mode array2d_ui ^ elem(in,  in ) = out is det.
 :- mode in       ^ elem(in,  in ) = out is det.
 
     % T ^ unsafe_elem(I, J) is the same as T ^ elem(I, J) except that
     % behaviour is undefined if not in_bounds(T, I, J).
     %
 :- func array2d(T) ^ unsafe_elem(int, int) = T.
-:- mode array2d_ui ^ unsafe_elem(in,  in ) = out is det.
+%:- mode array2d_ui ^ unsafe_elem(in,  in ) = out is det.
 :- mode in       ^ unsafe_elem(in,  in ) = out is det.
 
     % ( T0 ^ elem(I, J) := X ) = T
@@ -103,21 +103,21 @@
     % bounds(array2d([[X11, ..., X1N], ..., [XM1, ..., XMN]), M, N)
     %
 :- pred bounds(array2d(T), int, int).
-:- mode bounds(array2d_ui, out, out) is det.
+%:- mode bounds(array2d_ui, out, out) is det.
 :- mode bounds(in,       out, out) is det.
 
     % in_bounds(array2d([[X11, ..., X1N], ..., [XM1, ..., XMN]), I, J)
     % succeeds iff 0 =< I < M, 0 =< J < N.
     %
 :- pred in_bounds(array2d(T), int, int).
-:- mode in_bounds(array2d_ui, in,  in ) is semidet.
+%:- mode in_bounds(array2d_ui, in,  in ) is semidet.
 :- mode in_bounds(in,       in,  in ) is semidet.
 
     % lists(array2d([[X11, ..., X1N], ..., [XM1, ..., XMN])) =
     %     [[X11, ..., X1N], ..., [XM1, ..., XMN]]
     %
 :- func lists(array2d(T)) = list(list(T)).
-:- mode lists(array2d_ui) = out is det.
+%:- mode lists(array2d_ui) = out is det.
 :- mode lists(in        ) = out is det.
 
 %-----------------------------------------------------------------------------%
@@ -201,7 +201,7 @@
 
 :- func lists_2(int, int, int, array(T), list(T), list(list(T))) =
             list(list(T)).
-:- mode lists_2(in,  in,  in,  array_ui, in,      in           ) = out is det.
+%:- mode lists_2(in,  in,  in,  array_ui, in,      in           ) = out is det.
 :- mode lists_2(in,  in,  in,  in,       in,      in           ) = out is det.
 
 lists_2(IJ, J, N, A, Xs, Xss) =
Index: library/svarray.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/svarray.m,v
retrieving revision 1.5
diff -u -u -r1.5 svarray.m
--- library/svarray.m	19 Apr 2006 05:17:58 -0000	1.5
+++ library/svarray.m	16 Feb 2007 05:15:20 -0000
@@ -42,7 +42,7 @@
     % It is an error if the index is out of bounds.
     %
 :- pred svarray.slow_set(int, T, array(T), array(T)).
-:- mode svarray.slow_set(in, in, array_ui, array_uo) is det.
+%:- mode svarray.slow_set(in, in, array_ui, array_uo) is det.
 :- mode svarray.slow_set(in, in, in, array_uo) is det.
 
     % svarray.semidet_slow_set sets the nth element of an array,
@@ -52,7 +52,7 @@
     % It fails if the index is out of bounds.
     %
 :- pred svarray.semidet_slow_set(int, T, array(T), array(T)).
-:- mode svarray.semidet_slow_set(in, in, array_ui, array_uo) is semidet.
+%:- mode svarray.semidet_slow_set(in, in, array_ui, array_uo) is semidet.
 :- mode svarray.semidet_slow_set(in, in, in, array_uo) is semidet.
 
     % svarray.resize(Size, Init, Array0, Array):
Index: tests/hard_coded/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/Mmakefile,v
retrieving revision 1.311
diff -u -u -r1.311 Mmakefile
--- tests/hard_coded/Mmakefile	22 Feb 2007 05:56:44 -0000	1.311
+++ tests/hard_coded/Mmakefile	24 Feb 2007 03:19:37 -0000
@@ -10,6 +10,7 @@
 	agg \
 	any_call_hoist_bug \
 	any_free_unify \
+	array_test \
 	backquoted_qualified_ops \
 	bidirectional \
 	bitmap_test \
Index: tests/hard_coded/array_test.exp
===================================================================
RCS file: tests/hard_coded/array_test.exp
diff -N tests/hard_coded/array_test.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/array_test.exp	16 Feb 2007 04:36:18 -0000
@@ -0,0 +1 @@
+succeeded
Index: tests/hard_coded/array_test.m
===================================================================
RCS file: tests/hard_coded/array_test.m
diff -N tests/hard_coded/array_test.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/hard_coded/array_test.m	16 Feb 2007 04:35:58 -0000
@@ -0,0 +1,23 @@
+:- module array_test.
+
+:- interface.
+
+:- import_module array, bool, io.
+
+:- pred main(io::di, io::uo) is det.
+
+:- pred test(array(bool)::in(uniq_array(bound(yes))),
+		array(bool)::in(uniq_array(bound(yes)))) is semidet.
+
+:- pred test2(array(bool)::in(uniq_array(bound(no))),
+		array(bool)::in(uniq_array(bound(yes)))) is semidet.
+
+:- implementation.
+
+main(!IO) :-
+	io.write_string("succeeded\n", !IO).
+
+test(X, X).
+
+test2(X, X).
+
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list