[m-rev.] diff: rtti_implementation type bug on .NET

Peter Ross pro at missioncriticalit.com
Thu Nov 13 22:57:07 AEDT 2003


Hi,


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


Estimated hours taken: 2
Branches: main

Fix a bug where the null function was returning an object, while it
was meant to return a string.  This lead to failures when the mercury
generated code attempted to do a "castclass string".

library/rtti_implementation.m:
	Rename null to null_string and make it return a string.

Index: rtti_implementation.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/rtti_implementation.m,v
retrieving revision 1.45
diff -u -r1.45 rtti_implementation.m
--- rtti_implementation.m	7 Nov 2003 16:51:35 -0000	1.45
+++ rtti_implementation.m	13 Nov 2003 11:46:15 -0000
@@ -324,7 +324,7 @@
 		TypeInfoList = iterate(1, Arity, (func(I) =
 			unsafe_cast(TypeInfo ^ var_arity_type_info_index(I)))
 		),
-		Names = list__duplicate(Arity, null)
+		Names = list__duplicate(Arity, null_string)
 
 	; TypeCtorRep = int,
 		fail
@@ -418,7 +418,7 @@
 		Names = iterate(0, Arity - 1,
 				(func(I) = ArgNames ^ unsafe_index(I)))
 	;
-		Names = list__duplicate(Arity, null)
+		Names = list__duplicate(Arity, null_string)
 	).
 
 :- pred get_functor_enum(type_ctor_rep::in(enum),
@@ -2258,20 +2258,20 @@
 
  %--------------------------%
 
-:- func null = T.
+:- func null_string = string.
 :- pragma foreign_proc("C",
-	null = (T::out),
+	null_string = (Str::out),
 	[will_not_call_mercury, thread_safe, promise_pure],
 "
-	T = (MR_Word) NULL;
+	Str = (MR_Word) NULL;
 ").
 :- pragma foreign_proc("C#",
-	null = (T::out),
+	null_string = (Str::out),
 	[will_not_call_mercury, thread_safe, promise_pure],
 "
-	T = 0;
+	Str = null;
 ").
-null = _ :-
+null_string = _ :-
 	% This version is only used for back-ends for which there is no
 	% matching foreign_proc version.
+ 	private_builtin__sorry("rtti_implementation__null_string/0").



-- 
Peter Ross		
Software Engineer                                (Work)   +32 2 757 10 15
Mission Critical                                 (Mobile) +32 485 482 559
--------------------------------------------------------------------------
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