Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Urban <bernhard.urban@xamarin.com>2017-02-27 19:55:53 +0300
committerBernhard Urban <bernhard.urban@xamarin.com>2017-03-01 00:59:28 +0300
commit4accf0d718c238b3efcd50eed6fc6f86b9ae43cd (patch)
tree871dccd7192d8676e64f9630740c2498fc047ddc
parent1e7d4e140148498a797e96fb91733fe7fe302285 (diff)
[generics.cs] test calling an interface, that's implemented by a generic value type
-rw-r--r--mono/mini/generics.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/mono/mini/generics.cs b/mono/mini/generics.cs
index 9defe79f3cc..186fb90db91 100644
--- a/mono/mini/generics.cs
+++ b/mono/mini/generics.cs
@@ -233,6 +233,42 @@ class Tests
return 0;
}
+ interface NonGenericInterface {
+ int return_field ();
+ }
+
+ interface GenericInterface<T> : NonGenericInterface {
+ T not_used ();
+ }
+
+ struct ImplementGenericInterface<T> : GenericInterface<T> {
+ public Object padding1;
+ public Object padding2;
+ public Object padding3;
+ public T[] arr_t;
+
+ public ImplementGenericInterface (T[] arr_t) {
+ this.padding1 = null;
+ this.padding2 = null;
+ this.padding3 = null;
+ this.arr_t = arr_t;
+ }
+
+ public T not_used () {
+ return arr_t [0];
+ }
+
+ public int return_field () {
+ return arr_t.Length;
+ }
+ }
+
+ public static int test_8_struct_implements_generic_interface () {
+ int[] arr = {1, 2, 3, 4};
+ NonGenericInterface s = new ImplementGenericInterface<int> (arr);
+ return s.return_field () + s.return_field ();
+ }
+
[Category ("!INTERPRETER")]
public static int test_0_generic_get_value_optimization_vtype () {
TestStruct[] arr = new TestStruct[] { new TestStruct (100, 200), new TestStruct (300, 400) };