[mcs] Update logic when checking for tuple element names when overriding inherited...
authorMarek Safar <marek.safar@gmail.com>
Thu, 24 Aug 2017 08:37:05 +0000 (10:37 +0200)
committerMarek Safar <marek.safar@gmail.com>
Thu, 24 Aug 2017 08:38:25 +0000 (10:38 +0200)
mcs/mcs/tuples.cs
mcs/tests/test-tuple-06.cs [new file with mode: 0644]
mcs/tests/ver-il-net_4_x.xml

index 559c2f3ee43b32b2a6861129f397ea459fde7a11..bb7faf734df22e1fddf9404fac279a2a91619158 100644 (file)
@@ -234,15 +234,15 @@ namespace Mono.CSharp
                public static bool CheckOverrideName (TypeSpec type, TypeSpec baseType)
                {
                        var btype_ntuple = baseType as NamedTupleSpec;
-                       var mtype_ntupe = type as NamedTupleSpec;
-                       if (btype_ntuple == null && mtype_ntupe == null)
+                       var mtype_ntuple = type as NamedTupleSpec;
+                       if (btype_ntuple == null && mtype_ntuple == null)
                                return true;
 
-                       if (btype_ntuple != null || mtype_ntupe != null)
+                       if (btype_ntuple == null || mtype_ntuple == null)
                                return false;
 
                        var b_elements = btype_ntuple.elements;
-                       var m_elements = mtype_ntupe.elements;
+                       var m_elements = mtype_ntuple.elements;
                        for (int i = 0; i < b_elements.Count; ++i) {
                                if (b_elements [i] != m_elements [i])
                                        return false;
diff --git a/mcs/tests/test-tuple-06.cs b/mcs/tests/test-tuple-06.cs
new file mode 100644 (file)
index 0000000..64bb9b0
--- /dev/null
@@ -0,0 +1,19 @@
+class Base
+{
+       public virtual (int, long rest) Foo ()
+       {
+               return (1, 2);
+       }
+}
+
+class Test : Base
+{
+       public override (int, long rest) Foo ()
+       {
+               return (3, 4);
+       }
+
+       public static void Main ()
+       {       
+       }
+}
\ No newline at end of file
index d3c5c4ff729670f377698b2044e242d2abcefb1c..db5bfbd387c5090a47e7c7e01c8813a6cec6540e 100644 (file)
       </method>
     </type>
   </test>
+  <test name="test-tuple-06.cs">
+    <type name="Base">
+      <method name="System.ValueTuple`2[System.Int32,System.Int64] Foo()" attrs="454">
+        <size>17</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="Test">
+      <method name="System.ValueTuple`2[System.Int32,System.Int64] Foo()" attrs="198">
+        <size>17</size>
+      </method>
+      <method name="Void Main()" attrs="150">
+        <size>2</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="test-var-01.cs">
     <type name="Test">
       <method name="Int32 Main()" attrs="150">