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:
authorMartin Baulig <martin@novell.com>2003-07-26 21:48:25 +0400
committerMartin Baulig <martin@novell.com>2003-07-26 21:48:25 +0400
commit993839b510ad6a672cfc0d5305bdd184f42737c8 (patch)
tree3391fd7979213b8f336cda66652398801c0953f4 /mcs/tests/test-209.cs
parent43ccd1916edb14397468119032d9dd25ab4816b6 (diff)
2003-07-26 Martin Baulig <martin@ximian.com>
* test-209.cs: New test for implict conversions and embedded assignments. svn path=/trunk/mcs/; revision=16710
Diffstat (limited to 'mcs/tests/test-209.cs')
-rw-r--r--mcs/tests/test-209.cs76
1 files changed, 76 insertions, 0 deletions
diff --git a/mcs/tests/test-209.cs b/mcs/tests/test-209.cs
new file mode 100644
index 00000000000..4fe9b8d5e00
--- /dev/null
+++ b/mcs/tests/test-209.cs
@@ -0,0 +1,76 @@
+using System;
+
+struct A
+{
+ public readonly int i;
+
+ public A (int i)
+ {
+ this.i = i;
+ }
+}
+
+class X
+{
+ int i;
+
+ public int Foo {
+ get {
+ return 2 * i;
+ }
+
+ set {
+ i = value;
+ }
+ }
+
+ public int this [int a] {
+ get {
+ return (int) Foo;
+ }
+
+ set {
+ Foo = a;
+ }
+ }
+
+ public string this [string a] {
+ set {
+ Console.WriteLine (a);
+ }
+ }
+
+ public string Bar {
+ set {
+ Console.WriteLine (value);
+ }
+ }
+
+ public A A {
+ get {
+ return new A (5);
+ }
+
+ set {
+ Console.WriteLine (value);
+ }
+ }
+
+ public X (int i)
+ {
+ this.i = i;
+ }
+
+ public static int Main ()
+ {
+ X x = new X (9);
+ int a = x.Foo = 16;
+ int b = x [8] = 32;
+ x ["Test"] = "Hello";
+ x.Bar = "World";
+ x.A = new A (9);
+ // Compilation-only test.
+ return 0;
+ }
+}
+