[Mono-bugs] [Bug 76671][Nor] New - [PATCH] Ensure distinct MonoTypes on resolving a typespec in different contexts

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Nov 11 07:14:23 EST 2005


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by jankit at novell.com.

http://bugzilla.ximian.com/show_bug.cgi?id=76671

--- shadow/76671	2005-11-11 07:14:23.000000000 -0500
+++ shadow/76671.tmp.7776	2005-11-11 07:14:23.000000000 -0500
@@ -0,0 +1,78 @@
+Bug#: 76671
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: jankit at novell.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [PATCH] Ensure distinct MonoTypes on resolving a typespec in different contexts
+
+Description of Problem:
+
+When we resolve a given typespec in different contexts, we should obtain a 
+distinct MonoType for each context, and any GenericParams contained in that 
+MonoType should point to the correct context. This is necessary since the 
+generic_param->owner field can be used non-trivially, i.e., not just for 
+printing names.
+
+This gets exposed with monodis. test case:
+
+class X<T1> {
+   public static void Xfoo () {
+      X<T1>.Xfoo(); --> Single TypeSpec, (VAR !0)
+   }
+}
+
+class Y<T2> {
+   public static void Yfoo () {
+      X<T2>.Xfoo(); --> Same TypeSpec (VAR !0)
+   }
+}
+
+Compiled with csc (mcs emits duplicate TypeSpecs) and monodis'ed shows:
+
+.class private auto ansi beforefieldinit 'X`1'<T1>
+{
+   ...
+   .method public static void Xfoo ()  cil managed
+   {
+       ...
+       IL_0001:  call void class 'X`1'<!T1>::Xfoo() --> !T1 is correct in 
+this context
+       ...
+    }
+    ...
+}
+
+
+.class private auto ansi beforefieldinit 'Y`1'<T2>
+{
+    ...
+    .method public static void Yfoo ()  cil managed
+    {
+       ...
+       IL_0001:  call void class 'X`1'<!T1>::Xfoo() --> !T1 instead of !T2 
+*******
+       ...
+     }
+     ...
+}
+
+Attached are three test cases(including the one above) and a proposed patch.
+
+test1.cs: When the typespec is a GenericInst
+test2.cs: When the typespec is an array/szarray of GenericInst/VAR/MVAR
+test3.cs: When the typespec is a VAR/MVAR
+
+Also attached are the csc generated assemblies for the 3 test cases.
+
+Patch forged with Hari.


More information about the mono-bugs mailing list