From 4accf0d718c238b3efcd50eed6fc6f86b9ae43cd Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Mon, 27 Feb 2017 17:55:53 +0100 Subject: [generics.cs] test calling an interface, that's implemented by a generic value type --- mono/mini/generics.cs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) 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 : NonGenericInterface { + T not_used (); + } + + struct ImplementGenericInterface : GenericInterface { + 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 (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) }; -- cgit v1.2.3