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 <lewurm@gmail.com>2018-09-22 00:43:43 +0300
committerBernhard Urban <lewurm@gmail.com>2018-10-05 12:04:07 +0300
commit62f23a83652089b6054608bee59f0f7791bfe65e (patch)
tree59dabfb4c68edb4e27aa1cc2ef8a59f0401b25fb
parent2c48c62e66f535f8482923f73d32c8c7f6ac6035 (diff)
[interp] support ntype.ToString ()
-rw-r--r--mono/mini/builtin-types.cs37
-rw-r--r--mono/mini/interp/transform.c3
2 files changed, 40 insertions, 0 deletions
diff --git a/mono/mini/builtin-types.cs b/mono/mini/builtin-types.cs
index 3d5c6fff68c..0596116571e 100644
--- a/mono/mini/builtin-types.cs
+++ b/mono/mini/builtin-types.cs
@@ -301,6 +301,18 @@ public class BuiltinTests {
return 0;
}
+ static int test_0_nint_tostring ()
+ {
+ int x = 1337;
+ if (((nint) x).ToString () != "1337")
+ return 1;
+ x = -1337;
+ if (((nint) x).ToString () != "-1337")
+ return 2;
+
+ return 0;
+ }
+
[MethodImplAttribute (MethodImplOptions.NoInlining)]
static bool decimal_cmp (decimal a, decimal b)
{
@@ -696,6 +708,18 @@ public class BuiltinTests {
return 0;
}
+ static int test_0_nuint_tostring ()
+ {
+ int x = 1337;
+ if (((nuint) x).ToString () != "1337")
+ return 1;
+ x = -1337;
+ if (((nuint) x).ToString () == "-1337")
+ return 2;
+
+ return 0;
+ }
+
static int test_0_nuint_implicit_decimal ()
{
nuint a = new nuint (10);
@@ -1168,6 +1192,19 @@ public class BuiltinTests {
return 0;
}
+ static int test_0_nfloat_tostring ()
+ {
+ float x = 1337.0f;
+ nfloat y = (nfloat) x;
+ if (y.ToString () != "1337")
+ return 1;
+ x = -1337.0f;
+ if (((nfloat) x).ToString () != "-1337")
+ return 2;
+
+ return 0;
+ }
+
static int test_0_nfloat_explicit_decimal ()
{
nfloat a = new nfloat (10);
diff --git a/mono/mini/interp/transform.c b/mono/mini/interp/transform.c
index 964bfb67826..5a99c98d20f 100644
--- a/mono/mini/interp/transform.c
+++ b/mono/mini/interp/transform.c
@@ -1067,6 +1067,9 @@ interp_handle_intrinsics (TransformData *td, MonoMethod *target_method, MonoMeth
} else if (!strcmp ("Parse", tm)) {
/* white list */
return FALSE;
+ } else if (!strcmp ("ToString", tm)) {
+ /* white list */
+ return FALSE;
} else if (!strcmp ("IsNaN", tm) || !strcmp ("IsInfinity", tm) || !strcmp ("IsNegativeInfinity", tm) || !strcmp ("IsPositiveInfinity", tm)) {
g_assert (type_index == 2); // nfloat only
/* white list */