Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnome.org>2002-11-23 02:31:13 +0300
committerMiguel de Icaza <miguel@gnome.org>2002-11-23 02:31:13 +0300
commit11134d7f47ecccf9536fd77554c83c6b159ac49b (patch)
tree3f30d792ecfbc6729f2a9028a4100dfda0060e49 /mcs/tests/test-174.cs
parent3210b62b140129c67c5c6e867647db75eb50f799 (diff)
Improve this test
svn path=/trunk/mcs/; revision=9154
Diffstat (limited to 'mcs/tests/test-174.cs')
-rw-r--r--mcs/tests/test-174.cs110
1 files changed, 110 insertions, 0 deletions
diff --git a/mcs/tests/test-174.cs b/mcs/tests/test-174.cs
new file mode 100644
index 00000000000..55323c772de
--- /dev/null
+++ b/mcs/tests/test-174.cs
@@ -0,0 +1,110 @@
+//
+// This tests only checks if we can compile the program.
+//
+// The trick is that we are accessing a protected property, with the way
+// mcs deals with properties in two steps (property first, method next)
+// this text excercises some eager optimizations in the TypeManager.FilterWithClosure.
+//
+//
+// The second class excercises accessing private members from a container class
+//
+// The third class excercises accessing a private/protected value on an instance of
+// a child
+
+using System;
+using System.Collections;
+
+class ProtectedAccessToPropertyOnChild : Hashtable {
+
+ ProtectedAccessToPropertyOnChild ()
+ {
+ comparer = null;
+ }
+
+ static int Main ()
+ {
+ TestAccessToProtectedOnChildInstanceFromParent t = new TestAccessToProtectedOnChildInstanceFromParent ();
+
+ if (t.Test () != 0)
+ return 1;
+
+ return 0;
+
+ }
+}
+
+//
+// Again, only for compiling reasons
+//
+public class TestAccessToPrivateMemberInParentClass
+{
+ double[][] data;
+ int rows;
+ int columns;
+
+ public TestAccessToPrivateMemberInParentClass()
+ {
+ }
+
+ double[][] Array
+ {
+ get { return data; }
+ }
+
+ class CholeskyDecomposition
+ {
+ TestAccessToPrivateMemberInParentClass L;
+ bool isSymmetric;
+ bool isPositiveDefinite;
+
+ public CholeskyDecomposition(TestAccessToPrivateMemberInParentClass A)
+ {
+ L = new TestAccessToPrivateMemberInParentClass();
+
+ double[][] a = A.Array;
+ double[][] l = L.Array;
+ }
+ }
+}
+
+public class TestAccessToProtectedOnChildInstanceFromParent {
+
+ class Parent {
+ protected int a;
+
+ static int x;
+
+ Parent ()
+ {
+ a = x++;
+ }
+
+ public int TestAccessToProtected (Child c)
+ {
+ if (c.a == 0)
+ return 1;
+ else
+ return 2;
+ }
+ }
+
+ class Child : Parent {
+
+ }
+
+ Child c, d;
+
+ public TestAccessToProtectedOnChildInstanceFromParent ()
+ {
+ c = new Child ();
+ d = new Child ();
+ }
+
+ public int Test ()
+ {
+ if (d.TestAccessToProtected (c) == 1)
+ return 0;
+ return 1;
+ }
+
+}