Merge pull request #15293 from lewing/wasm-clean
[mono-project.git] / mcs / tests / test-174.cs
blob779adb845fe27fff3df14b4ca8253e4f012ae23c
1 //
2 // This tests only checks if we can compile the program.
3 //
4 // The trick is that we are accessing a protected property, with the way
5 // mcs deals with properties in two steps (property first, method next)
6 // this text excercises some eager optimizations in the TypeManager.FilterWithClosure.
7 //
8 //
9 // The second class excercises accessing private members from a container class
11 // The third class excercises accessing a private/protected value on an instance of
12 // a child
14 using System;
15 using System.Collections;
17 class ProtectedAccessToPropertyOnChild : Hashtable {
19 ProtectedAccessToPropertyOnChild ()
21 comparer = null;
24 public static int Main ()
26 TestAccessToProtectedOnChildInstanceFromParent t = new TestAccessToProtectedOnChildInstanceFromParent ();
28 if (t.Test () != 0)
29 return 1;
31 return 0;
37 // Again, only for compiling reasons
39 public class TestAccessToPrivateMemberInParentClass
41 double[][] data;
42 int rows;
43 int columns;
45 public TestAccessToPrivateMemberInParentClass()
49 double[][] Array
51 get { return data; }
54 class CholeskyDecomposition
56 TestAccessToPrivateMemberInParentClass L;
57 bool isSymmetric;
58 bool isPositiveDefinite;
60 public CholeskyDecomposition(TestAccessToPrivateMemberInParentClass A)
62 L = new TestAccessToPrivateMemberInParentClass();
64 double[][] a = A.Array;
65 double[][] l = L.Array;
70 public class TestAccessToProtectedOnChildInstanceFromParent {
72 class Parent {
73 protected int a;
75 static int x;
77 protected Parent ()
79 a = x++;
82 public int TestAccessToProtected (Child c)
84 if (c.a == 0)
85 return 1;
86 else
87 return 2;
91 class Child : Parent {
95 Child c, d;
97 public TestAccessToProtectedOnChildInstanceFromParent ()
99 c = new Child ();
100 d = new Child ();
103 public int Test ()
105 if (d.TestAccessToProtected (c) == 1)
106 return 0;
107 return 1;