[netcore] Ongoing work. (#13391)
[mono-project.git] / mono / tests / recursive-struct-arrays.cs
blobdd1c8b262f3f8a886261612e911159a5c2540496
1 using System;
3 /* Test that the runtime can represent value types that have array fields that
4 * recursively refer to the same value type */
6 struct S1 {
7 static S1[][] foo;
10 struct S2 {
11 static S2[] foo;
14 struct S3a {
15 static S3b[] foo;
18 struct S3b {
19 static S3a[][] foo;
22 struct P<X> where X : struct {
23 static P<X>[][] foo;
26 public struct S4
28 private static S4[][] foo;
30 public static readonly S4 West = new S4(-1, 0);
31 public static readonly S4 East = new S4(1, 0);
32 public static readonly S4 North = new S4(0, 1);
33 public static readonly S4 South = new S4(0, -1);
34 public static readonly S4[] Directions = { North, South, East, West };
36 public readonly int x;
37 public readonly int z;
39 public S4(int x, int z)
41 this.x = x;
42 this.z = z;
45 public override string ToString()
47 return string.Format("[{0}, {1}]", x, z);
52 class Program {
53 static int Main() {
54 Console.WriteLine (typeof (S1).Name);
55 Console.WriteLine (typeof (S2).Name);
56 Console.WriteLine (typeof (S3a).Name);
57 Console.WriteLine (typeof (S3b).Name);
58 foreach (var s4 in S4.Directions) {
59 Console.WriteLine (s4);
61 Console.WriteLine (typeof (P<S1>).Name);
62 Console.WriteLine (typeof (P<int>).Name);
63 return 0;