[corlib] Add a special method for XI so the linker does not always have to generate it.
[mono-project.git] / mcs / tests / gtest-optional-22.cs
blob1f736ff6f5da917f3842ee89c752f53d22b99fc4
1 using System;
2 using System.Collections.Generic;
3 using System.Runtime.CompilerServices;
4 using System.Linq;
6 interface I
8 void Explicit ();
11 class CallerMemberTest : I
13 object field = TraceStatic ("field");
15 CallerMemberTest ()
16 : this (TraceStatic (".ctor"))
20 CallerMemberTest (object arg)
24 static IEnumerable<int> Enumerator ()
26 TraceStatic ("Enumerator");
27 yield return 1;
30 void I.Explicit ()
32 Trace ("Explicit");
35 public void GenericMethod<T> ()
37 Trace ("GenericMethod");
40 public int this [string arg] {
41 set {
42 Trace ("Item");
46 public bool Property {
47 get {
48 Trace ("Property");
49 return false;
53 public static implicit operator CallerMemberTest (int i)
55 TraceStatic ("op_Implicit");
56 return new CallerMemberTest ();
59 public void Trace(string expected, [CallerMemberName] string member = ";;")
61 Console.WriteLine (member);
62 if (expected != member)
63 throw new ApplicationException (member);
66 public static object TraceStatic(string expected, [CallerMemberName] object member = null)
68 Console.WriteLine (member);
70 if (expected != member as string)
71 throw new ApplicationException (string.Format ("`{0}' != `{1}'", expected, member as string));
73 return member;
76 public static void Main ()
78 var c = new CallerMemberTest ();
79 c.Trace ("Main");
80 Action a = () => {
81 c.Trace ("Main");
83 a ();
85 a = () => TraceStatic ("Main");
86 a ();
88 foreach (var e in Enumerator ()) {
91 var atype = new {
92 OO = TraceStatic ("Main")
95 var l = (from x in "ab" select TraceStatic ("Main")).ToList ();
97 c.GenericMethod<long> ();
98 c ["aa"] = 4;
99 var p = c.Property;
101 I i = c;
102 i.Explicit ();
104 CallerMemberTest op = 1;