Bug 30973

Summary: Incorrect CS0425 when generic base class implements non-generic interface method
Product: [Mono] Compilers Reporter: peter
Component: C#Assignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: mono-bugs+mono, victor.briant
Priority: ---    
Version: 4.0.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Tags: Is this bug a regression?: ---
Last known good build:

Description peter 2015-06-10 09:41:11 UTC
Compiling the following:
	public class BaseClass<TSource> {
		public void DoStuff<TInput>( TInput stuff )
			where TInput: TSource {
		}
	}

	public class MyClass: BaseClass<TInterface>, MyInterface {

	}

	public interface TInterface {

	}

	public interface MyInterface {
		void DoStuff<TInput>( TInput stuff )
			where TInput: TInterface;
	}

Results in the following when compiled as "Mono/.NET 4.5" with Mono 4.0.1 in monodevelop 5.9.4 on Ubuntu 15.04.

error CS0425: The constraints for type parameter `TInput' of method `MonoTypeConstraintBug.BaseClass<MonoTypeConstraintBug.TInterface>.DoStuff<TInput>(TInput)' must match the constraints for type parameter `TInput' of interface method `MonoTypeConstraintBug.MyInterface.DoStuff<TInput>(TInput)'. Consider using an explicit interface implementation instead.

It compiles fine with VS2012/.NET 4.5.

I can see that several similar bug reports exists against earlier versions that are marked as "fixed in master" (for example https://bugzilla.xamarin.com/show_bug.cgi?id=22131 ), but at least it still seems to be a problem in 4.0.1.
Comment 1 Marek Safar 2015-06-16 11:57:21 UTC
Fixed in master
Comment 2 Victor 2015-10-28 16:34:45 UTC
This is NOT fixed in master (using Xamarin Studio 5.9.7 and Xamarin iOS 9.0.1)