[m-rev.] diff: fix spurious errors in tests/valid for grade il

Peter Ross pro at missioncriticalit.com
Thu Nov 7 23:58:59 AEDT 2002


Hi,

Now only intermod_pragma_import (bug ??) and soln_context (bug B9) fail
in the tests/valid directory.

We need to add intermod_pragma_import into the list of bugs, as it
doesn't seem to match the symptoms of any other of the listed bugs.

===================================================================


Estimated hours taken: 2
Branches: main

Fix spurious errors in the test cases so that they pass in the grade il.

tests/valid/big_foreign_type.m:
	Add C# implementations of the foreign types.

tests/valid/int64.m:
tests/valid/liveness_nonlocals.m:
tests/valid/subtype_switch.m:
tests/valid/tabled_for_io.m:
tests/valid/two_pragma_c_codes.m:
tests/valid/zero_arity.m:
	Provide default implementations of C pragma foreign_code.

tests/valid/intermod_impure2.m:
	Provide an il implementation of C pragma foreign_code.

tests/valid/spurious_purity_warning.m:
	Fix some determinism warnings.

tests/valid/typeclass_inlining_bug.m:
	Remove an unneeded abstract type.

Index: tests/valid/big_foreign_type.m
===================================================================
RCS file: /home/mercury1/repository/tests/valid/big_foreign_type.m,v
retrieving revision 1.1
diff -u -r1.1 big_foreign_type.m
--- tests/valid/big_foreign_type.m	30 Oct 2002 03:30:24 -0000	1.1
+++ tests/valid/big_foreign_type.m	7 Nov 2002 12:47:58 -0000
@@ -6,12 +6,16 @@
 
 :- type foo.
 :- pragma foreign_type(c, foo, "struct Foo").
+:- pragma foreign_type(il, foo, "class [big_foreign_type__csharp_code]Foo").
 :- type foo2.
 :- pragma foreign_type(c, foo2, "char").
+:- pragma foreign_type(il, foo2, "valuetype [mscorlib]System.Char").
 :- type foo3.
 :- pragma foreign_type(c, foo3, "double").
+:- pragma foreign_type(il, foo3, "valuetype [mscorlib]System.Double").
 :- type foo4.
 :- pragma foreign_type(c, foo4, "enum e").
+:- pragma foreign_type(il, foo4, "valuetype [big_foreign_type__csharp_code]e").
 
 :- func bar(foo) = foo.
 :- func bar2(foo2) = foo2.
@@ -33,6 +37,14 @@
 	enum e { e0, e1, e2, e42 = 42 };
 ").
 
+:- pragma foreign_decl("C#", "
+public class Foo {
+	int x, y, z;
+}
+
+public enum e { e0, e1, e2, e42=42 };
+").
+
 :- pragma foreign_proc(c, bar(X::in) = (Y::out),
 	[will_not_call_mercury, promise_pure], "Y = X;").
 :- pragma foreign_proc(c, bar2(X::in) = (Y::out),
@@ -40,6 +52,15 @@
 :- pragma foreign_proc(c, bar3(X::in) = (Y::out),
 	[will_not_call_mercury, promise_pure], "Y = 2.0 * X;").
 :- pragma foreign_proc(c, bar4(X::in) = (Y::out),
+	[will_not_call_mercury, promise_pure], "Y = X;").
+
+:- pragma foreign_proc("C#", bar(X::in) = (Y::out),
+	[will_not_call_mercury, promise_pure], "Y = X;").
+:- pragma foreign_proc("C#", bar2(X::in) = (Y::out),
+	[will_not_call_mercury, promise_pure], "Y = X;").
+:- pragma foreign_proc("C#", bar3(X::in) = (Y::out),
+	[will_not_call_mercury, promise_pure], "Y = 2.0 * X;").
+:- pragma foreign_proc("C#", bar4(X::in) = (Y::out),
 	[will_not_call_mercury, promise_pure], "Y = X;").
 
 baz(X) = X.
Index: tests/valid/int64.m
===================================================================
RCS file: /home/mercury1/repository/tests/valid/int64.m,v
retrieving revision 1.1
diff -u -r1.1 int64.m
--- tests/valid/int64.m	27 Jan 1999 08:34:38 -0000	1.1
+++ tests/valid/int64.m	7 Nov 2002 12:47:58 -0000
@@ -16,3 +16,6 @@
 :- type int64 == int.
 
 :- pragma c_code((A::in) /\ (B::in) = (C::out), [], "C = A & B;").
+
+% implementation for the other backends.
+A /\ _B = A.
Index: tests/valid/intermod_impure2.m
===================================================================
RCS file: /home/mercury1/repository/tests/valid/intermod_impure2.m,v
retrieving revision 1.1
diff -u -r1.1 intermod_impure2.m
--- tests/valid/intermod_impure2.m	25 Aug 1999 06:11:19 -0000	1.1
+++ tests/valid/intermod_impure2.m	7 Nov 2002 12:47:58 -0000
@@ -22,3 +22,11 @@
 printf(""Output from impure predicate\\n"");
 Int = 2;
 ").
+:- pragma foreign_proc(il, intermod_impure_2(Int::out),
+		[will_not_call_mercury, max_stack_size(1)],
+"
+	ldstr ""Output from impure predicate\\n""
+	call void class [mscorlib]System.Console.Write(string)
+	ldc.i4 2
+	stloc Int
+").
Index: tests/valid/liveness_nonlocals.m
===================================================================
RCS file: /home/mercury1/repository/tests/valid/liveness_nonlocals.m,v
retrieving revision 1.1
diff -u -r1.1 liveness_nonlocals.m
--- tests/valid/liveness_nonlocals.m	16 Oct 1997 07:01:58 -0000	1.1
+++ tests/valid/liveness_nonlocals.m	7 Nov 2002 12:47:58 -0000
@@ -43,6 +43,7 @@
 
 :- pragma c_code(foo_int(_V2::in, Res::out(bound(0))),
  	will_not_call_mercury, "Res = 0").
+foo_int(_, 0).
 
 :- pred int_to_bool(int, bool).
 :- mode int_to_bool(in(bound(1)), out(bound(yes))) is det.
Index: tests/valid/spurious_purity_warning.m
===================================================================
RCS file: /home/mercury1/repository/tests/valid/spurious_purity_warning.m,v
retrieving revision 1.1
diff -u -r1.1 spurious_purity_warning.m
--- tests/valid/spurious_purity_warning.m	4 Jan 2002 05:56:40 -0000	1.1
+++ tests/valid/spurious_purity_warning.m	7 Nov 2002 12:47:58 -0000
@@ -5,12 +5,20 @@
 :- impure pred bar(int::in) is det.
 
 :- implementation.
-:- import_module require.
+:- import_module require, std_util.
 
-foo(_::out) :-
-	error("foo/1").
+foo(X::out) :-
+	( semidet_succeed ->
+		error("foo/1")
+	;
+		X = 5
+	).
 bar(_::in) :-
-	error("bar/1").
+	( semidet_succeed ->
+		error("bar/1")
+	;
+		true
+	).
 
 :- pragma foreign_proc("C", foo(X::out),
 	[will_not_call_mercury, thread_safe],
Index: tests/valid/subtype_switch.m
===================================================================
RCS file: /home/mercury1/repository/tests/valid/subtype_switch.m,v
retrieving revision 1.4
diff -u -r1.4 subtype_switch.m
--- tests/valid/subtype_switch.m	5 Dec 2000 02:11:23 -0000	1.4
+++ tests/valid/subtype_switch.m	7 Nov 2002 12:47:58 -0000
@@ -4,7 +4,7 @@
 
 :- interface.
 
-:- import_module io, std_util.
+:- import_module io.
 
 :- type widget.
 
@@ -73,6 +73,7 @@
 	Int = tk_direct_thingy_counter;
 	IO = IO0;
 ").
+get_thingy_counter(5) --> [].
 
 :- pred set_thingy_counter(int::in, io__state::di, io__state::uo) is det.
 
@@ -80,6 +81,7 @@
 	tk_direct_thingy_counter = Int;
 	IO = IO0;
 ").
+set_thingy_counter(_) --> [].
 
 :- pred command_wrapper(pred(tcl_interp, io__state, io__state), tcl_interp,
 		list(string), tcl_status, string, io__state, io__state).
Index: tests/valid/tabled_for_io.m
===================================================================
RCS file: /home/mercury1/repository/tests/valid/tabled_for_io.m,v
retrieving revision 1.1
diff -u -r1.1 tabled_for_io.m
--- tests/valid/tabled_for_io.m	27 Oct 2000 03:13:04 -0000	1.1
+++ tests/valid/tabled_for_io.m	7 Nov 2002 12:47:58 -0000
@@ -17,3 +17,4 @@
 	B = A;
 	IO = IO0;
 ").
+test(X, X) --> [].
Index: tests/valid/two_pragma_c_codes.m
===================================================================
RCS file: /home/mercury1/repository/tests/valid/two_pragma_c_codes.m,v
retrieving revision 1.1
diff -u -r1.1 two_pragma_c_codes.m
--- tests/valid/two_pragma_c_codes.m	20 Nov 1995 09:33:44 -0000	1.1
+++ tests/valid/two_pragma_c_codes.m	7 Nov 2002 12:47:58 -0000
@@ -18,3 +18,5 @@
 
 :- pragma(c_code, c_int_unify(Int::out, Int0::in), "Int = Int0;").
 
+c_int_unify(X, X).
+
Index: tests/valid/typeclass_inlining_bug.m
===================================================================
RCS file: /home/mercury1/repository/tests/valid/typeclass_inlining_bug.m,v
retrieving revision 1.1
diff -u -r1.1 typeclass_inlining_bug.m
--- tests/valid/typeclass_inlining_bug.m	21 Jul 2002 08:00:54 -0000	1.1
+++ tests/valid/typeclass_inlining_bug.m	7 Nov 2002 12:47:58 -0000
@@ -19,8 +19,6 @@
 
 :- typeclass answer_pattern(Answer) where [].
 
-:- type analysis_info.
-
 :- pred lookup_call_pattern(Call::in, list(analysis)::in,
 	list(Answer)::out) is det <= analysis(Call, Answer).
 
Index: tests/valid/zero_arity.m
===================================================================
RCS file: /home/mercury1/repository/tests/valid/zero_arity.m,v
retrieving revision 1.4
diff -u -r1.4 zero_arity.m
--- tests/valid/zero_arity.m	18 Feb 2002 07:01:28 -0000	1.4
+++ tests/valid/zero_arity.m	7 Nov 2002 12:47:58 -0000
@@ -44,3 +44,6 @@
 	SUCCESS_INDICATOR = MR_FALSE;
 #endif
 ").
+
+use_asm_labels :-
+	fail.

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list