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:
authorMarek Safar <marek.safar@gmail.com>2014-11-13 19:18:01 +0300
committerMarek Safar <marek.safar@gmail.com>2014-11-13 19:19:04 +0300
commit4697ef6e7790380227e79b2b128fd7227c712647 (patch)
treef0b914d1657e30693b60aa2e6b2ced708d6c1f2b /mcs/tests/gtest-autoproperty-12.cs
parenta32054ece952bd9d3dd436dddb57d096a11ed4ee (diff)
[mcs] More updates to auto-properties v6 implementation
Diffstat (limited to 'mcs/tests/gtest-autoproperty-12.cs')
-rw-r--r--mcs/tests/gtest-autoproperty-12.cs48
1 files changed, 48 insertions, 0 deletions
diff --git a/mcs/tests/gtest-autoproperty-12.cs b/mcs/tests/gtest-autoproperty-12.cs
new file mode 100644
index 00000000000..c738c3914c5
--- /dev/null
+++ b/mcs/tests/gtest-autoproperty-12.cs
@@ -0,0 +1,48 @@
+using System;
+
+public class A
+{
+ public int X { get; }
+ public virtual int Y { get; }
+
+ public A ()
+ {
+ X = 4;
+ X++;
+
+ Y = 2;
+ Y++;
+ }
+}
+
+class B : A
+{
+ int i_get;
+
+ public override int Y { get { ++i_get; return base.Y; } }
+
+ public static int Main ()
+ {
+ var a = new A ();
+ if (a.X != 5)
+ return 1;
+
+ if (a.Y != 3)
+ return 2;
+
+ var b = new B ();
+ if (b.X != 5)
+ return 3;
+
+ if (b.i_get != 1)
+ return 4;
+
+ if (b.Y != 3)
+ return 5;
+
+ if (b.i_get != 2)
+ return 6;
+
+ return 0;
+ }
+}