Bugzilla – Bug 320704
[PATCH][GMCS] incorrect CS0121 - ambiguity between generic method definition and generic method instance in different assembly
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by atsushi@ximian.com 2006-03-29 17:08:25 MST ---- gmcs fails to compile such code that invokes generic method in referenced assembly, because of incorrect ambiguity error (CS0121). It happens between generic method definition and generic method, only when those methods are defined in different assembly. $ cat zzz.cs public class A : X { public override void Whoa<T> (object arg) { } } public abstract class X { // virtual is also buggy public abstract void Whoa<T> (object arg); } $ cat yyy.cs class Test { public void Foo () { A x = new A (); x.Whoa<int> (null); } } Steps to reproduce the problem: 1. gmcs -t:library zzz.cs 2. gmcs yyy.cs -r:zzz.dll Actual Results: $ gmcs yyy.cs -r:zzz.dll yyy.cs(6,3): error CS0121: The call is ambiguous between the following methods o r properties: `X.Whoa<Int32>(object)' and `X.Whoa<T>(object)' C:\cygwin\home\atsushi\tests\gmcs-bugs\zzz.dll: `X.Whoa<Int32>(object)', name of symbol related to previous error C:\cygwin\home\atsushi\tests\gmcs-bugs\zzz.dll: `X.Whoa<T>(object)', name of sym bol related to previous error Compilation failed: 1 error(s), 0 warnings Expected Results: no CS0121 error. How often does this happen? consistently. Additional Information: it is also recent regression which started to happen this month or last month. ---- Additional Comments From atsushi@ximian.com 2006-03-31 02:22:13 MST ---- Created an attachment (id=169512) proposed fix ---- Additional Comments From atsushi@ximian.com 2006-03-31 02:24:15 MST ---- I still think that there should be a corresponding code that checks this kind of check that the patch does (to drop the cases that one is GenericMethodDefinition and one is not) since it does not happen when those methods are in the same assembly. But right now, my hands are a bit shorter ;-) ---- Additional Comments From rharinath@novell.com 2006-03-31 06:50:37 MST ---- Generic method definitions should not be part of overload resolution. I'm working on an alternate approach. ---- Additional Comments From rharinath@novell.com 2006-04-01 07:05:39 MST ---- Should be fixed in SVN r58887. Imported an attachment (id=169512) Unknown operating system unknown. Setting to default OS "Other".