Permalink
Browse files

Unify the way the interfaces are checked for shadowing

  • Loading branch information...
1 parent a4d66b1 commit 19f259840cf3d63e141cdb0be3f2aabe3a88f49f @marek-safar marek-safar committed Jan 19, 2011
Showing with 45 additions and 2 deletions.
  1. +2 −2 mcs/mcs/membercache.cs
  2. +43 −0 mcs/tests/test-804.cs
View
@@ -366,7 +366,7 @@ static bool AddInterfaceMember (MemberSpec member, ref IList<MemberSpec> existin
}
if (member.DeclaringType.ImplementsInterface (entry.DeclaringType, false)) {
- if (existing is MemberSpec[]) {
+ if (existing.Count == 1) {
existing = new MemberSpec[] { member };
return true;
}
@@ -380,7 +380,7 @@ static bool AddInterfaceMember (MemberSpec member, ref IList<MemberSpec> existin
return false;
}
- if (existing is MemberSpec[]) {
+ if (existing.Count == 1) {
existing = new List<MemberSpec> () { existing[0], member };
return true;
}
View
@@ -0,0 +1,43 @@
+using System;
+
+interface IA
+{
+ int Foo { get; }
+}
+
+interface IB_1 : IA
+{
+ new string Foo { get; }
+}
+
+interface IB_2 : IA
+{
+ new char Foo { get; }
+}
+
+interface IC : IB_2, IB_1
+{
+ new byte Foo { get; }
+}
+
+class A : IA
+{
+ public int Foo { get { return 3; } }
+}
+
+class B : A, IB_1
+{
+ public new string Foo { get { return "1"; } }
+}
+
+class C : B, IC
+{
+ char IB_2.Foo { get { return 'a'; } }
+
+ public new byte Foo { get { return 2; } }
+
+ public static void Main ()
+ {
+ new C ();
+ }
+}

0 comments on commit 19f2598

Please sign in to comment.