[m-rev.] diff: fix type specialization abort

Simon Taylor stayl at cs.mu.OZ.AU
Wed Apr 24 03:50:24 AEST 2002


Estimated hours taken: 0.5
Branches: main

Fix a bug reported by Peter Ross.

compiler/special_pred.m:
	Don't generate unification predicates for foreign types lazily. 
	The clauses contain calls to a polymorphic predicate
	(private_builtin__nyi_foreign_type_unify) which
	polymorphism__process_generated_pred can't handle
	after polymorphism has been run.

tests/valid/Mmakefile:
tests/valid/foreign_type_spec.m:
	Test case.

Index: compiler/special_pred.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/special_pred.m,v
retrieving revision 1.30
diff -u -u -r1.30 special_pred.m
--- compiler/special_pred.m	28 Mar 2002 03:43:37 -0000	1.30
+++ compiler/special_pred.m	23 Apr 2002 17:31:35 -0000
@@ -195,6 +195,15 @@
 		globals__lookup_bool_option(Globals, special_preds, no)
 	),
 
+	%
+	% We can't generate clauses for unification predicates for
+	% foreign types lazily because they call the polymorphic procedure
+	% private_builtin__nyi_foreign_type_unify.
+	% polymorphism__process_generated_pred can't handle calls to
+	% polymorphic procedures after the initial polymorphism pass.
+	%
+	Body \= foreign_type(_, _, _),
+
 	% The special predicates for types with user-defined
 	% equality or existentially typed constructors are always
 	% generated immediately by make_hlds.m.
Index: tests/valid/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/valid/Mmakefile,v
retrieving revision 1.96
diff -u -u -r1.96 Mmakefile
--- tests/valid/Mmakefile	14 Mar 2002 01:10:44 -0000	1.96
+++ tests/valid/Mmakefile	23 Apr 2002 16:24:35 -0000
@@ -70,6 +70,7 @@
 	explicit_quant.m \
 	fail_ite.m \
 	followcode_det_problem.m \
+	foreign_type_spec.m \
 	func_int_bug_main.m \
 	func_default_modes.m \
 	headvar_not_found.m \
Index: tests/valid/foreign_type_spec.m
===================================================================
RCS file: tests/valid/foreign_type_spec.m
diff -N tests/valid/foreign_type_spec.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/valid/foreign_type_spec.m	23 Apr 2002 16:21:30 -0000
@@ -0,0 +1,17 @@
+:- module foreign_type_spec.
+
+:- interface.
+
+:- import_module foreign_type_spec__foreign_type.
+
+:- type ft2
+	--->	f(foreign).
+
+:- module foreign_type_spec__foreign_type.
+
+:- interface.
+
+:- type foreign.
+:- pragma foreign_type(il, foreign, "class [mscorlib]System.Object").
+
+:- end_module foreign_type_spec__foreign_type.
--------------------------------------------------------------------------
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