codeowners update
[mono.git] / mcs / tests / test-16.cs
index 1fccf5e19caaeddbed37fbc4eddf69a4be15388c..3c59e917e191c39d521ce0560b5750e20aa461ee 100644 (file)
@@ -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,20 @@ namespace Mine {
                        int number = new Foo () + new Foo () ;
                        Console.WriteLine (number);
 
-                       int k = new Foo ();
+                       Foo tmp = new Foo ();
+                       
+                       int k = tmp;
+
+                       Console.WriteLine ("Convert from Foo to float");
+                       float f = tmp;
+                       Console.WriteLine ("Converted");
+
+                       // 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;