Bugzilla – Bug 324702
[GMCS] Wrong method names with type parameters produced
Last modified: 2008-10-01 15:07:49 UTC
---- Reported by gert.driesen@pandora.be 2007-07-07 04:02:23 MST ---- When a method of property name includes type parameters (eg. implicit interface implementation), then gmcs current produces wrong names. Example 1 C# code: T IConvert<T>.Result { get { return default (T); } } IL: * MS * .method private hidebysig newslot specialname virtual final instance !T 'IConvert<T>.get_Result'() cil managed * Mono * .method private hidebysig newslot specialname virtual final instance !T 'IConvert`1[T].get_Result'() cil managed Example 2 C# code: void IConvert<KeyPair<K, T>>.Convert (KeyPair<K, T> x, KeyPair<K, T> y) { } IL: * MS * .method private hidebysig newslot virtual final instance void 'IConvert<KeyPair<K,T>>.Convert'(class KeyPair`2<!K,!T> x, class KeyPair`2<!K,!T> y) cil managed * Mono * .method private hidebysig newslot virtual final instance void 'IConvert`1[[KeyPair`2[K,T], test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].Convert'(class KeyPair`2<!K,!T> x, class KeyPair`2<!K,!T> y) cil managed I've attached the source code, and both the MS and Mono produced IL. Compiling the source code using CSC are running it on either Mono or MS results in the following (expected) output: IConvert<KeyPair<K,T>>.Convert IConvert<KeyPair<K,T>>.get_Result Compiling it using GMCS and running it on either Mono or MS yields the following output: IConvert`1[[KeyPair`2[K,T], test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].Convert IConvert`1[[KeyPair`2[K,T], test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].get_Result ---- Additional Comments From gert.driesen@pandora.be 2007-07-07 04:02:41 MST ---- Created an attachment (id=172249) C# source code ---- Additional Comments From gert.driesen@pandora.be 2007-07-07 04:02:59 MST ---- Created an attachment (id=172250) Mono IL ---- Additional Comments From gert.driesen@pandora.be 2007-07-07 04:03:26 MST ---- Created an attachment (id=172251) MS IL Imported an attachment (id=172249) Imported an attachment (id=172250) Imported an attachment (id=172251)
Although this is not a bug, generated names of explicit interface members are not defined and are implementation dependent. However, I have made a fix to emit shorter names and in most cases we now emit same names as csc.