Bug 324702 (MONO82028) - [GMCS] Wrong method names with type parameters produced
Summary: [GMCS] Wrong method names with type parameters produced
Status: RESOLVED FIXED
Alias: MONO82028
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.2
Hardware: Other All
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Marek Safar
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-07 11:02 UTC by Gert Driesen
Modified: 2008-10-01 15:07 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
C# source code (1.05 KB, text/plain)
2007-07-07 11:02 UTC, Thomas Wiest
Details
Mono IL (22.79 KB, text/plain)
2007-07-07 11:02 UTC, Thomas Wiest
Details
MS IL (23.53 KB, text/plain)
2007-07-07 11:03 UTC, Thomas Wiest
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:43:19 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)
Comment 2 Marek Safar 2008-10-01 15:07:49 UTC
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.