[System] Tweak socket test
[mono-project.git] / mono / tests / generic-inlining.2.cs
blobc112b973ed4bd3b3b1a6d4fe757a7086c3692ead
1 using System.Collections.Generic;
2 using System.Runtime.CompilerServices;
4 public class Gen<T> {
5 public T[] method () {
6 return new T[3];
9 public static T[] staticMethod () {
10 return new T[3];
13 public S[] genericMethod<S> () {
14 return new S[3];
18 public class main {
19 static bool callMethod<T> (Gen<T> g) {
20 return g.method ().GetType () == typeof (T[]);
23 static bool callStaticMethod<T> () {
24 return Gen<T>.staticMethod ().GetType () == typeof (T[]);
27 static bool callGenericMethod<T,S> (Gen<T> g) {
28 return g.genericMethod<S> ().GetType () == typeof (S[]);
31 [MethodImpl (MethodImplOptions.NoInlining)]
32 static bool work<T,S> () {
33 Gen<T> g = new Gen<T> ();
35 if (!callMethod<T> (g))
36 return false;
37 if (!callStaticMethod<T> ())
38 return false;
39 if (!callGenericMethod<T,S> (g))
40 return false;
41 return true;
44 public static int Main () {
45 if (!work<string,string> ())
46 return 1;
47 if (!work<int,int> ())
48 return 1;
49 if (!work<string,int> ())
50 return 1;
51 if (!work<int,string> ())
52 return 1;
53 return 0;