Exclude operators from member access lookup
authorMarek Safar <marek.safar@gmail.com>
Wed, 30 Jan 2013 14:32:12 +0000 (15:32 +0100)
committerMarek Safar <marek.safar@gmail.com>
Wed, 30 Jan 2013 14:55:58 +0000 (15:55 +0100)
mcs/mcs/ecore.cs
mcs/tests/test-862.cs [new file with mode: 0644]

index 8f4beda22b4afc15d454dabb1f8195cc7e9eccc6..fe7297013e30772bbaa96eae9940a1a5adcc1154 100644 (file)
@@ -696,7 +696,7 @@ namespace Mono.CSharp {
                                        if ((member.Modifiers & Modifiers.OVERRIDE) != 0 && member.Kind != MemberKind.Event)
                                                continue;
 
-                                       if ((member.Modifiers & Modifiers.BACKING_FIELD) != 0)
+                                       if ((member.Modifiers & Modifiers.BACKING_FIELD) != 0 || member.Kind == MemberKind.Operator)
                                                continue;
 
                                        if ((arity > 0 || (restrictions & MemberLookupRestrictions.ExactArity) != 0) && member.Arity != arity)
diff --git a/mcs/tests/test-862.cs b/mcs/tests/test-862.cs
new file mode 100644 (file)
index 0000000..2a9c433
--- /dev/null
@@ -0,0 +1,22 @@
+class op_Addition
+{
+       public static int Foo = 42;
+
+       public class Builder
+       {
+               public int Foo
+               {
+                       get { return op_Addition.Foo; }
+               }
+
+               public static int operator + (Builder a, Builder b)
+               {
+                       return 0;
+               }
+       }
+
+       public static void Main ()
+       {
+               var x = new Builder ().Foo;
+       }
+}
\ No newline at end of file