Flush (work in progress)
[mono.git] / mcs / errors / gcs1502-2.cs
1 // CS1502: The best overloaded method match for `A.A(System.Collections.Generic.IList<int>[])' has some invalid arguments
2 // Line: 40
3 using System;
4 using System.Collections;
5 using System.Collections.Generic;
6
7 public struct MyStruct : IList<int>
8 {
9         public int this [int x] { get { return 0; } set { return; } }
10         public int IndexOf (int x) { return 0; }
11         public void Insert (int x, int y) { return; }
12         public void RemoveAt (int x) { return; }
13         public int Count { get { return 0; } }
14         public bool IsReadOnly { get { return false; } }
15         public void Add (int x) { return; }
16         public void Clear () { return; }
17         public bool Contains (int x) { return false; }
18         public void CopyTo (int[] x, int y) { return; }
19         public bool Remove (int x) { return false; }
20         public IEnumerator<int> GetEnumerator() { yield return 0; }
21         IEnumerator IEnumerable.GetEnumerator() { yield return 0; }
22 }
23
24 public class A
25 {
26         // This version does not compile:
27         public A(IList<int>[] x) { }
28
29         // This version compiles fine, but results in an exception:
30         public A(IList<IList<int>> x) { }
31 }
32
33 public class Test
34 {
35         static void Main ()
36         {
37                 MyStruct[] myStructArray = new MyStruct[1];
38
39                 Console.WriteLine ("Trying to construct an A...");
40                 A a = new A (myStructArray);
41                 Console.WriteLine ("success!");
42         }
43 }