Bug 9443 - mcs failed to compile explicit interface implementation if the method has parameter that is generic type with constraint type parameter
Summary: mcs failed to compile explicit interface implementation if the method has par...
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2013-01-10 02:47 UTC by wanghengwei
Modified: 2013-01-14 11:00 UTC (History)
1 user (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description wanghengwei 2013-01-10 02:47:33 UTC
debian testing
mcs 2.10.8.1

Consider the following code:

//file bug.cs
using System;

interface IParam<T>
  where T : IParam<T>
{}

interface IA
{
  void f<T>(IParam<T> p)
    where T : IParam<T>;
}

class A : IA
{
  void IA.f<T>(IParam<T> p)
  {
  }
}

//end

there's an error while compiling with mcs -t:library:

bug.cs(17,30): error CS0314: The type `T' cannot be used as type parameter `T' in the generic type or method `a.IParam<T>'. There is no boxing or type parameter conversion from `T' to `a.IParam<T>'

ms csc is ok.

if changing the explicit implementation to implicit, there's no error:
//this is ok
class A : IA
{
  public void f<T>(IParam<T> p)
    where T : IParam<T>
  {
  }
}
Comment 1 Marek Safar 2013-01-14 11:00:55 UTC
Fixed in master

Note You need to log in before you can comment on or make changes to this bug.