|
Bugzilla – Full Text Bug Listing |
| Summary: | CS0309 with generic methods where constraints have generic parameters | ||
|---|---|---|---|
| Product: | [Mono] Mono: Compilers | Reporter: | Gael Fraiteur <gael> |
| Component: | C# | Assignee: | Mono Bugs <mono-bugs> |
| Status: | RESOLVED DUPLICATE | QA Contact: | Mono Bugs <mono-bugs> |
| Severity: | Normal | ||
| Priority: | P3 - Medium | CC: | eugene.shalygin |
| Version: | 2.4.x | ||
| Target Milestone: | --- | ||
| Hardware: | x86-64 | ||
| OS: | Other | ||
| URL: | http://www.postsharp.org/ | ||
| Whiteboard: | |||
| Found By: | Customer | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
|
Description
Gael Fraiteur
2008-10-27 08:25:53 UTC
Could you please attach a test which reproduces the issue? I guess that I'm able to provide required information.
Here is sample program:
using System;
namespace test
{
interface I<T>
{
T Get();
}
class G<A,C>
where C:struct, I<A>
{
public void M<CA>(G<A, CA> g)
where CA:struct, I<A>
{
}
}
struct Iint1:I<int>
{
public int Get()
{
return 0;
}
}
struct Iint2:I<int>
{
public int Get()
{
return 0;
}
}
class MainClass
{
public static void Main (string[] args)
{
G<int, Iint1> gint1 = new G<int, Iint1>();
G<int, Iint2> gint2 = new G<int, Iint2>();
gint1.M<Iint2>(gint2);
}
}
}
compiler output:
/home/eugene/Projects/test/test/Main.cs(46,31): error CS0309: The type `test.Iint2' must be convertible to `test.I<test.Iint2>' in order to use it as parameter `CA' in the generic type or method `test.G<A,C>.M<CA>(test.G<A,CA>)'
/home/eugene/Projects/test/test/Main.cs(18,29): (Location of the symbol related to previous error)
/home/eugene/Projects/test/test/Main.cs(32,16): (Location of the symbol related to previous error)
$ mono --version
Mono JIT compiler version 2.2 (tarball Tue Jan 27 22:46:36 EET 2009)
$ uname -srmi
Linux 2.6.28-tuxonice-r4 x86_64 GenuineIntel
current svn version failed to compile this code and results in ICE: $ mono gmcs.exe /home/eugene/Projects/test/test/Main.cs Unhandled Exception: Mono.CSharp.InternalErrorException: /home/eugene/Projects/test/test/Main.cs(24,16): test.Iint1 ---> Mono.CSharp.InternalErrorException: Parameters are not registered for method `test.I<int>.Get' at Mono.CSharp.TypeManager.GetParameterData (System.Reflection.MethodBase mb) [0x00000] at Mono.CSharp.PendingImplementation..ctor (Mono.CSharp.TypeContainer container, .MissingInterfacesInfo[] missing_ifaces, System.Collections.ArrayList abstract_methods, Int32 total) [0x00000] at Mono.CSharp.PendingImplementation.GetPendingImplementations (Mono.CSharp.TypeContainer container) [0x00000] at Mono.CSharp.TypeContainer.DoDefineMembers () [0x00000] at Mono.CSharp.TypeContainer.Define () [0x00000] at Mono.CSharp.ClassOrStruct.Define () [0x00000] at Mono.CSharp.RootContext.PopulateTypes () [0x00000] --- End of inner exception stack trace --- at Mono.CSharp.RootContext.PopulateTypes () [0x00000] at Mono.CSharp.Driver.Compile () [0x00000] at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] Still exists in mono-2.4 Fixed in trunk. *** This bug has been marked as a duplicate of bug 537402 *** |