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>2017-10-03 16:27:11 +0300
committerMarek Safar <marek.safar@gmail.com>2017-10-03 18:01:58 +0300
commit1004d95b6b70e8b67a2b6782e0832faab9fa269a (patch)
tree73b2be1f8ccdaf2bbed0fcbd295edb971eb26a38 /mcs/errors
parent1bcf21e0480acf5dc4d68bf4e8b700217e35eb92 (diff)
[mcs] Implements C# 7.2 readonly structs
Diffstat (limited to 'mcs/errors')
-rw-r--r--mcs/errors/cs0106-11.cs7
-rw-r--r--mcs/errors/cs0459-5.cs13
-rw-r--r--mcs/errors/cs1604-2.cs11
-rw-r--r--mcs/errors/cs1605-2.cs16
-rw-r--r--mcs/errors/cs1644-56.cs7
-rw-r--r--mcs/errors/cs8145.cs2
-rw-r--r--mcs/errors/cs8340-2.cs13
-rw-r--r--mcs/errors/cs8340.cs8
-rw-r--r--mcs/errors/cs8341.cs8
-rw-r--r--mcs/errors/cs8342.cs10
10 files changed, 94 insertions, 1 deletions
diff --git a/mcs/errors/cs0106-11.cs b/mcs/errors/cs0106-11.cs
new file mode 100644
index 00000000000..9aa99e36bc6
--- /dev/null
+++ b/mcs/errors/cs0106-11.cs
@@ -0,0 +1,7 @@
+// CS0106: The modifier `readonly' is not valid for this item
+// Line: 6
+// Compiler option: -langversion:latest
+
+readonly interface I
+{
+}
diff --git a/mcs/errors/cs0459-5.cs b/mcs/errors/cs0459-5.cs
new file mode 100644
index 00000000000..fa2cfd27dae
--- /dev/null
+++ b/mcs/errors/cs0459-5.cs
@@ -0,0 +1,13 @@
+// CS0459: Cannot take the address of `this' because it is read-only
+// Line: 11
+// Compiler options: -unsafe -langversion:latest
+
+readonly struct X
+{
+ unsafe void Test ()
+ {
+ fixed (X* x = &this) {
+
+ }
+ }
+}
diff --git a/mcs/errors/cs1604-2.cs b/mcs/errors/cs1604-2.cs
new file mode 100644
index 00000000000..7116ba3dafa
--- /dev/null
+++ b/mcs/errors/cs1604-2.cs
@@ -0,0 +1,11 @@
+// CS1604: Cannot assign to `this' because it is read-only
+// Line: 8
+// Compiler options: -langversion:latest
+
+readonly struct S
+{
+ void Foo ()
+ {
+ this = new S ();
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs1605-2.cs b/mcs/errors/cs1605-2.cs
new file mode 100644
index 00000000000..738899bfe4f
--- /dev/null
+++ b/mcs/errors/cs1605-2.cs
@@ -0,0 +1,16 @@
+// CS1605: Cannot pass `this' as a ref or out argument because it is read-only
+// Line: 14
+// Compiler options: -langversion:latest
+
+readonly struct X
+{
+ void Test (out X x)
+ {
+ x = new X ();
+ }
+
+ void Run ()
+ {
+ Test (out this);
+ }
+}
diff --git a/mcs/errors/cs1644-56.cs b/mcs/errors/cs1644-56.cs
new file mode 100644
index 00000000000..de713efba4d
--- /dev/null
+++ b/mcs/errors/cs1644-56.cs
@@ -0,0 +1,7 @@
+// CS1644: Feature `readonly structs' cannot be used because it is not part of the C# 7.0 language specification
+// Line: 5
+// Compiler options: -langversion:7
+
+readonly struct S
+{
+} \ No newline at end of file
diff --git a/mcs/errors/cs8145.cs b/mcs/errors/cs8145.cs
index cf3c5084722..ffbadfd67df 100644
--- a/mcs/errors/cs8145.cs
+++ b/mcs/errors/cs8145.cs
@@ -1,4 +1,4 @@
-// CS8145: Auto-implemented properties cannot return by reference
+// CS8145: Auto-implemented property `X.TestProp' cannot return by reference
// Line: 6
public class X
diff --git a/mcs/errors/cs8340-2.cs b/mcs/errors/cs8340-2.cs
new file mode 100644
index 00000000000..9236e9468b8
--- /dev/null
+++ b/mcs/errors/cs8340-2.cs
@@ -0,0 +1,13 @@
+// CS8340: `S.field': Instance fields in readonly structs must be readonly
+// Line: 6
+// Compiler options: -langversion:latest
+
+readonly partial struct S
+{
+
+}
+
+partial struct S
+{
+ int field;
+} \ No newline at end of file
diff --git a/mcs/errors/cs8340.cs b/mcs/errors/cs8340.cs
new file mode 100644
index 00000000000..fb3376708b2
--- /dev/null
+++ b/mcs/errors/cs8340.cs
@@ -0,0 +1,8 @@
+// CS8340: `S.field': Instance fields in readonly structs must be readonly
+// Line: 6
+// Compiler options: -langversion:latest
+
+readonly struct S
+{
+ int field;
+} \ No newline at end of file
diff --git a/mcs/errors/cs8341.cs b/mcs/errors/cs8341.cs
new file mode 100644
index 00000000000..c78406345fe
--- /dev/null
+++ b/mcs/errors/cs8341.cs
@@ -0,0 +1,8 @@
+// CS8341: Auto-implemented instance property `S.field' in readonly structs must be readonly
+// Line: 6
+// Compiler options: -langversion:latest
+
+readonly struct S
+{
+ int field { get; set; }
+} \ No newline at end of file
diff --git a/mcs/errors/cs8342.cs b/mcs/errors/cs8342.cs
new file mode 100644
index 00000000000..d6d7f43f0bf
--- /dev/null
+++ b/mcs/errors/cs8342.cs
@@ -0,0 +1,10 @@
+// CS8342: `S.e': Field-like instance events are not allowed in readonly structs
+// Line: 6
+// Compiler options: -langversion:latest
+
+using System;
+
+readonly struct S
+{
+ event Action e;
+} \ No newline at end of file