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>2018-01-16 15:10:20 +0300
committerMarek Safar <marek.safar@gmail.com>2018-01-17 16:43:18 +0300
commitc282af6df5ffbc7fc4ec2ab857299c8d455f9d72 (patch)
tree9a93083743e40585b303b1f9f5a90ad584874e13 /mcs/errors
parent3f372d06eeb4b924a26871c91a2100205fb10550 (diff)
[mcs] Implements C# 7.0 discards
Diffstat (limited to 'mcs/errors')
-rw-r--r--mcs/errors/cs0029-42.cs10
-rw-r--r--mcs/errors/cs0103-18.cs10
-rw-r--r--mcs/errors/cs1644-60.cs11
-rw-r--r--mcs/errors/cs8183.cs11
-rw-r--r--mcs/errors/cs8207.cs19
-rw-r--r--mcs/errors/cs8209.cs10
-rw-r--r--mcs/errors/cs8323.cs15
-rw-r--r--mcs/errors/cs8324.cs12
8 files changed, 98 insertions, 0 deletions
diff --git a/mcs/errors/cs0029-42.cs b/mcs/errors/cs0029-42.cs
new file mode 100644
index 00000000000..c7671000c76
--- /dev/null
+++ b/mcs/errors/cs0029-42.cs
@@ -0,0 +1,10 @@
+// CS0029: Cannot implicitly convert type `string' to `int'
+// Line: 8
+
+class C
+{
+ void Exists (int _)
+ {
+ _ = "2";
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs0103-18.cs b/mcs/errors/cs0103-18.cs
new file mode 100644
index 00000000000..8cec755d23d
--- /dev/null
+++ b/mcs/errors/cs0103-18.cs
@@ -0,0 +1,10 @@
+// CS0103: The name `_' does not exist in the current context
+// Line: 8
+
+class C
+{
+ void Test ()
+ {
+ _.ToString ();
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs1644-60.cs b/mcs/errors/cs1644-60.cs
new file mode 100644
index 00000000000..ca9547bc561
--- /dev/null
+++ b/mcs/errors/cs1644-60.cs
@@ -0,0 +1,11 @@
+// CS1644: Feature `discards' cannot be used because it is not part of the C# 6.0 language specification
+// Line: 9
+// Compiler options: -langversion:6
+
+class X
+{
+ int Test ()
+ {
+ _ = 2;
+ }
+}
diff --git a/mcs/errors/cs8183.cs b/mcs/errors/cs8183.cs
new file mode 100644
index 00000000000..f9e9004b737
--- /dev/null
+++ b/mcs/errors/cs8183.cs
@@ -0,0 +1,11 @@
+// CS8183: Cannot infer the type of implicitly-typed discard
+// Line: 9
+// Compiler options: -langversion:7.2
+
+class X
+{
+ public static void Main ()
+ {
+ _ = default;
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs8207.cs b/mcs/errors/cs8207.cs
new file mode 100644
index 00000000000..31090948b45
--- /dev/null
+++ b/mcs/errors/cs8207.cs
@@ -0,0 +1,19 @@
+// CS8207: An expression tree cannot contain a discard
+// Line: 11
+
+using System;
+using System.Linq.Expressions;
+
+class X
+{
+ void Test ()
+ {
+ Expression<Func<bool>> e = () => TryGetValue (out _);
+ }
+
+ bool TryGetValue (out int arg)
+ {
+ arg = 3;
+ return true;
+ }
+}
diff --git a/mcs/errors/cs8209.cs b/mcs/errors/cs8209.cs
new file mode 100644
index 00000000000..3a46a206c8e
--- /dev/null
+++ b/mcs/errors/cs8209.cs
@@ -0,0 +1,10 @@
+// CS8209: Cannot assign void to a discard
+// Line: 8
+
+class C
+{
+ public static void Main ()
+ {
+ _ = Main ();
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs8323.cs b/mcs/errors/cs8323.cs
new file mode 100644
index 00000000000..c6c9309ec0d
--- /dev/null
+++ b/mcs/errors/cs8323.cs
@@ -0,0 +1,15 @@
+// CS8323: Named argument `str' is used out of position but is followed by positional argument
+// Line: 9
+// Compiler options: -langversion:7.2
+
+class X
+{
+ public static void Main ()
+ {
+ Test (str: "", "");
+ }
+
+ static void Test (int arg, string str)
+ {
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs8324.cs b/mcs/errors/cs8324.cs
new file mode 100644
index 00000000000..8a0be1aefb9
--- /dev/null
+++ b/mcs/errors/cs8324.cs
@@ -0,0 +1,12 @@
+// CS8324: Named argument specifications must appear after all fixed arguments have been specified in a dynamic invocation
+// Line: 10
+// Compiler options: -langversion:7.2
+
+class C
+{
+ void M ()
+ {
+ dynamic d = new object ();
+ d.M (arg: 1, "");
+ }
+} \ No newline at end of file