[m-dev.] diff: test case for exist_q_tvar bug fix

David Glen JEFFERY dgj at cs.mu.OZ.AU
Thu Sep 24 20:08:16 AEST 1998


On 24-Sep-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 24-Sep-1998, David Glen JEFFERY <dgj at cs.mu.OZ.AU> wrote:
> > 
> > main -->
> > 	{ blah(101, _) }.
> > 
> > :- some [T1] pred blah(T, T1).
> > :- mode blah(in, out) is det.
> > 
> > blah(X, X).
> 
> I think it would be good to test that we actually generate correct
> code for this case. 

Agreed.

> Actually a couple more tests might be worthwhile.

Agreed again. Here's a revised test case:


Estimated hours taken: 0.2

hard_coded/existential_bound_tvar.m:
	A test case for the exist_q_tvar bug
hard_coded/existential_bound_tvar.exp:
	The expected output for the test case.
hard_coded/Mmakefile:
	Add the new test case.


cvs diff: Diffing .
Index: Mmakefile
===================================================================
RCS file: /home/staff/zs/imp/tests/hard_coded/Mmakefile,v
retrieving revision 1.34
diff -u -t -r1.34 Mmakefile
--- Mmakefile	1998/06/22 01:06:38	1.34
+++ Mmakefile	1998/09/24 09:47:39
@@ -23,6 +23,7 @@
         division_test \
         dupcall_types_bug \
         elim_special_pred \
+        existential_bound_tvar \
         eqv_type_bug \
         error_func \
         erroneous_liveness \

New file: existential_bound_tvar.m
===================================================================
:- module existential_bound_tvar.

:- interface.

:- pred main(io__state::di, io__state::uo) is det.

:- import_module io.

:- implementation.

:- import_module list, std_util.

main -->
	{ blah(101, X) },
	print("X: value = "), print(X), nl,
	print("X: type = "), print(type_of(X)), nl,

	{ blah2(101, Y) },
	print("Y: value = "), print(Y), nl,
	print("Y: type = "), print(type_of(Y)), nl,

	(
		{ blah3([101], Z) }
	->
		print("Z: value = "), print(Z), nl,
		print("Z: type = "), print(type_of(Z)), nl
	;
		write("ERROR\n")
	).

:- some [T1] pred blah(T, T1).
:- mode blah(in, out) is det.

blah(X, X).
  
:- some [T1] pred blah2(T, T1).
:- mode blah2(in, out) is det.

blah2(X, [X]).

:- some [T1] pred blah3(list(T), T1).
:- mode blah3(in, out) is semidet.

blah3([X], X).


New file: existential_bound_tvar.exp:
===================================================================
X: value = 101
X: type = int
Y: value = [101]
Y: type = list:list(int)
Z: value = 101
Z: type = int
===================================================================

dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) |  Marge: Did you just call everyone "chicken"?
PhD student,                    |  Homer: Noooo.  I swear on this Bible!
Department of Computer Science  |  Marge: That's not a Bible; that's a book of
University of Melbourne         |         carpet samples!
Australia                       |  Homer: Ooooh... Fuzzy.



More information about the developers mailing list