//
bool found;
if (!TypeSpecComparer.Override.IsEqual (BaseType, other.BaseType)) {
- if (other.targs == null)
- return false;
-
found = false;
- foreach (var otarg in other.targs) {
- if (TypeSpecComparer.Override.IsEqual (BaseType, otarg)) {
- found = true;
- break;
+ if (other.targs != null) {
+ foreach (var otarg in other.targs) {
+ if (TypeSpecComparer.Override.IsEqual (BaseType, otarg)) {
+ found = true;
+ break;
+ }
+ }
+ } else if (targs != null) {
+ foreach (var targ in targs) {
+ if (TypeSpecComparer.Override.IsEqual (targ, other.BaseType)) {
+ found = true;
+ break;
+ }
}
}
// Check interfaces implementation <- definition
if (other.InterfacesDefined != null) {
- if (InterfacesDefined == null)
- return false;
-
//
// Iterate over inflated interfaces
//
foreach (var oiface in other.Interfaces) {
found = false;
- foreach (var iface in Interfaces) {
- if (TypeSpecComparer.Override.IsEqual (iface, oiface)) {
- found = true;
- break;
+
+ if (InterfacesDefined != null) {
+ foreach (var iface in Interfaces) {
+ if (TypeSpecComparer.Override.IsEqual (iface, oiface)) {
+ found = true;
+ break;
+ }
+ }
+ } else if (targs != null) {
+ foreach (var targ in targs) {
+ if (TypeSpecComparer.Override.IsEqual (targ, oiface)) {
+ found = true;
+ break;
+ }
}
}
// Check type parameters implementation -> definition
if (targs != null) {
- if (other.targs == null)
- return false;
-
foreach (var targ in targs) {
found = false;
- foreach (var otarg in other.targs) {
- if (TypeSpecComparer.Override.IsEqual (targ, otarg)) {
- found = true;
- break;
+
+ if (other.targs != null) {
+ foreach (var otarg in other.targs) {
+ if (TypeSpecComparer.Override.IsEqual (targ, otarg)) {
+ found = true;
+ break;
+ }
}
}
+ if (other.InterfacesDefined != null && !found) {
+ foreach (var iface in other.Interfaces) {
+ if (TypeSpecComparer.Override.IsEqual (iface, targ)) {
+ found = true;
+ break;
+ }
+ }
+ }
+
+ if (!found)
+ found = TypeSpecComparer.Override.IsEqual (targ, other.BaseType);
+
if (!found)
return false;
}
--- /dev/null
+public class BaseClass<TSource>
+{
+ public void DoStuff<TInput> (TInput stuff) where TInput: TSource
+ {
+ }
+}
+
+public class MyClass: BaseClass<TInterface>, MyInterface
+{
+ public static void Main ()
+ {
+ }
+}
+
+public interface TInterface
+{
+}
+
+public interface MyInterface
+{
+ void DoStuff<TInput> (TInput stuff) where TInput: TInterface;
+}
\ No newline at end of file
--- /dev/null
+public class BaseClass<TSource>
+{
+ public void DoStuff<TInput> (TInput stuff) where TInput: TSource
+ {
+ }
+}
+
+public class MyClass: BaseClass<TInterface>, MyInterface
+{
+ public static void Main ()
+ {
+ }
+}
+
+public class TInterface
+{
+}
+
+public interface MyInterface
+{
+ void DoStuff<TInput> (TInput stuff) where TInput: TInterface;
+}
\ No newline at end of file
</method>
</type>
</test>
+ <test name="dtest-061.cs">
+ <type name="Test.Program">
+ <method name="Void Main()" attrs="150">
+ <size>88</size>
+ </method>
+ <method name="Void AreEqual[A,B](A, B)" attrs="150">
+ <size>54</size>
+ </method>
+ <method name="Void ShiftTest(Int32, Int32)" attrs="134">
+ <size>2459</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ <method name="Void .cctor()" attrs="6289">
+ <size>24</size>
+ </method>
+ </type>
+ </test>
<test name="dtest-anontype-01.cs">
<type name="C">
<method name="Void Main()" attrs="150">
</method>
</type>
</test>
+ <test name="gtest-631.cs">
+ <type name="BaseClass`1[TSource]">
+ <method name="Void DoStuff[TInput](TInput)" attrs="134">
+ <size>2</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="MyClass">
+ <method name="Void Main()" attrs="150">
+ <size>2</size>
+ </method>
+ <method name="Void MyInterface.DoStuff[TInput](TInput)" attrs="993">
+ <size>8</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
+ <test name="gtest-632.cs">
+ <type name="BaseClass`1[TSource]">
+ <method name="Void DoStuff[TInput](TInput)" attrs="134">
+ <size>2</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="MyClass">
+ <method name="Void Main()" attrs="150">
+ <size>2</size>
+ </method>
+ <method name="Void MyInterface.DoStuff[TInput](TInput)" attrs="993">
+ <size>8</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="TInterface">
+ <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">