// }
//
if (!IsMissingType (type) && type.IsGenericTypeDefinition) {
- var start_pos = spec.DeclaringType == null ? 0 : spec.DeclaringType.MemberDefinition.TypeParametersCount;
+ var start_pos = GetDeclaringTypesTypeParametersCount (spec);
var targs = CreateGenericArguments (start_pos, type.GetGenericArguments (), dtype);
spec = spec.MakeGenericType (module, targs);
}
return tspec;
}
+ static int GetDeclaringTypesTypeParametersCount (TypeSpec spec)
+ {
+ int total = 0;
+ while (spec.DeclaringType != null) {
+ total += spec.DeclaringType.MemberDefinition.TypeParametersCount;
+ spec = spec.DeclaringType;
+ }
+
+ return total;
+ }
+
public MethodSpec CreateMethod (MethodBase mb, TypeSpec declaringType)
{
Modifiers mod = ReadMethodModifiers (mb, declaringType);
--- /dev/null
+// Compiler options: -t:library
+
+public class Foo<T>
+{
+ public class Bar
+ {
+ public class FooBar : System.IEquatable<FooBar>
+ {
+ public bool Equals(FooBar a)
+ {
+ return true;
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+// Compiler options: -r:gtest-641-lib.dll
+
+using System;
+
+class SomeClass
+{
+ public static void Main ()
+ {
+ IEquatable<Foo<int>.Bar.FooBar> a = new Foo<int>.Bar.FooBar ();
+ }
+}
</method>
</type>
</test>
+ <test name="gtest-641.cs">
+ <type name="SomeClass">
+ <method name="Void Main()" attrs="150">
+ <size>8</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="gtest-anontype-01.cs">
<type name="Test">
<method name="Int32 Main()" attrs="150">