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:
authorRavi Pratap M <ravi@mono-cvs.ximian.com>2001-10-05 19:41:21 +0400
committerRavi Pratap M <ravi@mono-cvs.ximian.com>2001-10-05 19:41:21 +0400
commit1a14d9dd84c55ec866f51148389a91fc1fb261a7 (patch)
treeaee7dd9fc85177aa8b29a38e863e278df623e6f9 /mcs/tests/test-16.cs
parentf554a0c2e0bc6782fb7afecc2f5fee656469dcd2 (diff)
2001-10-05 Ravi Pratap <ravi@ximian.com>
* test-16.cs : Update to exercise the code which selects the best conversion operator based on "most encompassing/encompassed type" * test-7.cs : Update here too. svn path=/trunk/mcs/; revision=1099
Diffstat (limited to 'mcs/tests/test-16.cs')
-rw-r--r--mcs/tests/test-16.cs27
1 files changed, 25 insertions, 2 deletions
diff --git a/mcs/tests/test-16.cs b/mcs/tests/test-16.cs
index 1fccf5e19ca..0b45b1fc5cf 100644
--- a/mcs/tests/test-16.cs
+++ b/mcs/tests/test-16.cs
@@ -12,10 +12,22 @@ namespace Mine {
public static implicit operator int (Blah i)
{
- Console.WriteLine ("Converting from Blah->int");
+ Console.WriteLine ("Blah->int");
return 3;
}
+ public static implicit operator byte (Blah i)
+ {
+ Console.WriteLine ("Blah->byte");
+ return 0;
+ }
+
+ public static implicit operator short (Blah i)
+ {
+ Console.WriteLine ("Blah->short");
+ return 1;
+ }
+
}
public class Foo : Blah {
@@ -25,7 +37,18 @@ namespace Mine {
int number = new Foo () + new Foo () ;
Console.WriteLine (number);
- int k = new Foo ();
+ Foo tmp = new Foo ();
+
+ int k = tmp;
+
+ float f = tmp;
+
+ // The following will not work till we fix our UserCast::Emit
+ // to convert the return value on the stack.
+ if (f == 3)
+ Console.WriteLine ("Best implicit conversion selected correctly.");
+
+ Console.WriteLine ("F is {0}", f);
if (number == 2 && k == 3)
return 0;