[m-rev.] for review: comment out castclass System.Type[]

Peter Ross peter.ross at miscrit.be
Thu Dec 13 03:59:49 AEDT 2001


Hi,


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


Estimated hours taken: 8
Branches: main

System.Reflection.Assembly.GetExportedTypes returns an array of
System.Type however in Beta 2 of the CLR, when you try and do a
castclass to System.Type[] it fails.  The fix is not to do the
castclass.

compiler/ilasm.m:
    Disable castclasses where the type is System.Type[], by commenting
    the line out.

Index: compiler/ilasm.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ilasm.m,v
retrieving revision 1.26
diff -u -r1.26 ilasm.m
--- compiler/ilasm.m	31 Oct 2001 13:21:23 -0000	1.26
+++ compiler/ilasm.m	12 Dec 2001 16:51:41 -0000
@@ -1306,6 +1306,19 @@
 	output_type(Type, Info0, Info).
 
 output_instr(castclass(Type), Info0, Info) -->
+	(
+		{ Type = type(_, '[]'(ElementType, _)) },
+		{ ElementType = type(_, class(Name)) },
+		{ Name = structured_name(assembly("mscorlib"),
+				["System", "Type"], _) }
+	->
+		% XXX There is bug where castclass to System.Type[]
+		% sometimes erroneously fails, so we comment out these
+		% castclass's.
+		io__write_string("// ")
+	;
+		[]
+	),
 	io__write_string("castclass\t"),
 	output_type(Type, Info0, Info).
 

--------------------------------------------------------------------------
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