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:
authorMiguel de Icaza <miguel@gnome.org>2001-10-05 21:03:10 +0400
committerMiguel de Icaza <miguel@gnome.org>2001-10-05 21:03:10 +0400
commitf4f49dbf98499860cb270f5f7468477d1f7e413b (patch)
tree717bec5c4b6b11e3bbc016415d55cdfe7c034152 /mcs/tests/test-17.cs
parent6c6fecaea199ae35a480cc9e90f5c7f66a0f3ac1 (diff)
2001-10-05 Miguel de Icaza <miguel@ximian.com>
* expression.cs: Implicity convert the result from UserCast. Include the test from Ravi that exhibits the bug. New classes from Toelen. svn path=/trunk/mcs/; revision=1102
Diffstat (limited to 'mcs/tests/test-17.cs')
-rwxr-xr-xmcs/tests/test-17.cs45
1 files changed, 45 insertions, 0 deletions
diff --git a/mcs/tests/test-17.cs b/mcs/tests/test-17.cs
new file mode 100755
index 00000000000..c6e2a95745c
--- /dev/null
+++ b/mcs/tests/test-17.cs
@@ -0,0 +1,45 @@
+//
+// This test excercises user defined conversions and an implicit
+// conversion to a type afterwards.
+//
+//
+using System;
+
+class Blah {
+
+ public static int Main ()
+ {
+ Blah k = new Blah ();
+
+ float f = k;
+
+ if (f == 2){
+ Console.WriteLine ("Best implicit operator selected correctly");
+ return 0;
+ }
+ return 1;
+
+ }
+
+ 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 static implicit operator int (Blah i)
+ {
+ Console.WriteLine ("Blah->int");
+ return 2;
+ }
+
+
+}
+