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-25 17:40:21 +0300
committerMarek Safar <marek.safar@gmail.com>2017-11-21 11:15:00 +0300
commit2c160ed9a7d88410b3dfb21d5c83ca8a04eac766 (patch)
treed708f8636a5634975843b5c7d6b9f2765df83fd5 /mcs/errors
parent73bd521c075b30bcbf349bdb7381d3b6b9fc3c69 (diff)
[mcs] C# 7.2 ref struct feature
Diffstat (limited to 'mcs/errors')
-rw-r--r--mcs/errors/cs0029-39.cs15
-rw-r--r--mcs/errors/cs0029-40.cs19
-rw-r--r--mcs/errors/cs0029-41.cs12
-rw-r--r--mcs/errors/cs0030-17.cs15
-rw-r--r--mcs/errors/cs0123-10.cs18
-rw-r--r--mcs/errors/cs0123-11.cs12
-rw-r--r--mcs/errors/cs0306-4.cs15
-rw-r--r--mcs/errors/cs0611-3.cs15
-rw-r--r--mcs/errors/cs1599-2.cs2
-rw-r--r--mcs/errors/cs1599-3.cs2
-rw-r--r--mcs/errors/cs1599-4.cs12
-rw-r--r--mcs/errors/cs1599.cs2
-rw-r--r--mcs/errors/cs1644-57.cs7
-rw-r--r--mcs/errors/cs4012-3.cs19
-rw-r--r--mcs/errors/cs8175-2.cs19
-rw-r--r--mcs/errors/cs8343.cs12
-rw-r--r--mcs/errors/cs8345-2.cs12
-rw-r--r--mcs/errors/cs8345.cs12
18 files changed, 217 insertions, 3 deletions
diff --git a/mcs/errors/cs0029-39.cs b/mcs/errors/cs0029-39.cs
new file mode 100644
index 00000000000..0ed200036dc
--- /dev/null
+++ b/mcs/errors/cs0029-39.cs
@@ -0,0 +1,15 @@
+// CS0029: Cannot implicitly convert type `S' to `object'
+// Line: 13
+// Compiler options: -langversion:latest
+
+public ref struct S
+{
+}
+
+class Test
+{
+ public static void Main ()
+ {
+ object o = new S ();
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs0029-40.cs b/mcs/errors/cs0029-40.cs
new file mode 100644
index 00000000000..6d9167c31fa
--- /dev/null
+++ b/mcs/errors/cs0029-40.cs
@@ -0,0 +1,19 @@
+// CS0029: Cannot implicitly convert type `S' to `System.ValueType'
+// Line: 16
+// Compiler options: -langversion:latest
+
+using System;
+
+public ref struct S
+{
+}
+
+class Test
+{
+ public static void Main ()
+ {
+ var s = default (S);
+ ValueType s2 = s;
+ var res = default (S).ToString ();
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs0029-41.cs b/mcs/errors/cs0029-41.cs
new file mode 100644
index 00000000000..1a65f52f737
--- /dev/null
+++ b/mcs/errors/cs0029-41.cs
@@ -0,0 +1,12 @@
+// CS0029: Cannot implicitly convert type `System.TypedReference' to `object'
+// Line: 10
+
+using System;
+
+class Test
+{
+ public static void Main ()
+ {
+ var res = default (TypedReference).ToString ();
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs0030-17.cs b/mcs/errors/cs0030-17.cs
new file mode 100644
index 00000000000..b72b8bf71e5
--- /dev/null
+++ b/mcs/errors/cs0030-17.cs
@@ -0,0 +1,15 @@
+// CS0030: Cannot convert type `object' to `S'
+// Line: 13
+// Compiler options: -langversion:latest
+
+ref struct S
+{
+}
+
+class X
+{
+ public static void Foo (object o)
+ {
+ var res = (S) o;
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs0123-10.cs b/mcs/errors/cs0123-10.cs
new file mode 100644
index 00000000000..43d5e5d6368
--- /dev/null
+++ b/mcs/errors/cs0123-10.cs
@@ -0,0 +1,18 @@
+// CS0123: A method or delegate `object.ToString()' parameters do not match delegate `System.Func<string>()' parameters
+// Line: 16
+// Compiler options: -langversion:latest
+
+using System;
+
+public ref struct S
+{
+}
+
+class Test
+{
+ public static void Main ()
+ {
+ var s = new S ();
+ Func<string> f = s.ToString;
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs0123-11.cs b/mcs/errors/cs0123-11.cs
new file mode 100644
index 00000000000..427b628c159
--- /dev/null
+++ b/mcs/errors/cs0123-11.cs
@@ -0,0 +1,12 @@
+// CS0123: A method or delegate `object.ToString()' parameters do not match delegate `System.Func<string>()' parameters
+// Line: 16
+
+using System;
+
+class Test
+{
+ public static void Main ()
+ {
+ Func<string> f = default (TypedReference).ToString;
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs0306-4.cs b/mcs/errors/cs0306-4.cs
new file mode 100644
index 00000000000..4653512e55b
--- /dev/null
+++ b/mcs/errors/cs0306-4.cs
@@ -0,0 +1,15 @@
+// CS0306: The type `S' may not be used as a type argument
+// Line: 13
+// Compiler options: -langversion:latest
+
+public ref struct S
+{
+}
+
+class Test<T>
+{
+ public static void Foo ()
+ {
+ Test<S> local;
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs0611-3.cs b/mcs/errors/cs0611-3.cs
new file mode 100644
index 00000000000..6eda773dd24
--- /dev/null
+++ b/mcs/errors/cs0611-3.cs
@@ -0,0 +1,15 @@
+// CS0611: Array elements cannot be of type `S'
+// Line: 13
+// Compiler options: -langversion:latest
+
+public ref struct S
+{
+}
+
+class Test
+{
+ public static void Main ()
+ {
+ var x = new S[0];
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs1599-2.cs b/mcs/errors/cs1599-2.cs
index 941ff6bb0d6..28aa05b2ed3 100644
--- a/mcs/errors/cs1599-2.cs
+++ b/mcs/errors/cs1599-2.cs
@@ -1,4 +1,4 @@
-// CS1599: Method or delegate cannot return type `System.ArgIterator'
+// CS1599: The return type of `System.ArgIterator' is not allowed
// Line: 8
using System;
diff --git a/mcs/errors/cs1599-3.cs b/mcs/errors/cs1599-3.cs
index e4869dcaf70..9d378099d82 100644
--- a/mcs/errors/cs1599-3.cs
+++ b/mcs/errors/cs1599-3.cs
@@ -1,4 +1,4 @@
-// CS1599: Method or delegate cannot return type `System.ArgIterator'
+// CS1599: The return type of `System.ArgIterator' is not allowed
// Line: 8
using System;
diff --git a/mcs/errors/cs1599-4.cs b/mcs/errors/cs1599-4.cs
new file mode 100644
index 00000000000..358eee59a13
--- /dev/null
+++ b/mcs/errors/cs1599-4.cs
@@ -0,0 +1,12 @@
+// CS1599: The return type of `System.TypedReference' is not allowed
+// Line: 8
+
+using System;
+
+public class Program
+{
+ public static TypedReference operator + (int a, Program b)
+ {
+ throw new ApplicationException ();
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs1599.cs b/mcs/errors/cs1599.cs
index 5cef32d7f97..871d9fb3e7a 100644
--- a/mcs/errors/cs1599.cs
+++ b/mcs/errors/cs1599.cs
@@ -1,4 +1,4 @@
-// CS1599: Method or delegate cannot return type `System.TypedReference'
+// CS1599: The return type of `System.TypedReference' is not allowed
// Line: 8
using System;
diff --git a/mcs/errors/cs1644-57.cs b/mcs/errors/cs1644-57.cs
new file mode 100644
index 00000000000..7ee98373080
--- /dev/null
+++ b/mcs/errors/cs1644-57.cs
@@ -0,0 +1,7 @@
+// CS1644: Feature `ref structs' cannot be used because it is not part of the C# 7.0 language specification
+// Line: 5
+// Compiler options: -langversion:7
+
+ref struct S
+{
+} \ No newline at end of file
diff --git a/mcs/errors/cs4012-3.cs b/mcs/errors/cs4012-3.cs
new file mode 100644
index 00000000000..fb3d1dc276f
--- /dev/null
+++ b/mcs/errors/cs4012-3.cs
@@ -0,0 +1,19 @@
+// CS4012: Parameters or local variables of type `S' cannot be declared in async methods or iterators
+// Line: 16
+// Compiler options: -langversion:latest
+
+using System;
+using System.Threading.Tasks;
+
+public ref struct S
+{
+}
+
+class C
+{
+ public async void Test ()
+ {
+ var tr = new S ();
+ await Task.Factory.StartNew (() => 6);
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs8175-2.cs b/mcs/errors/cs8175-2.cs
new file mode 100644
index 00000000000..27c4babf8bf
--- /dev/null
+++ b/mcs/errors/cs8175-2.cs
@@ -0,0 +1,19 @@
+// CS8175: Cannot use by-reference variable `s' inside an anonymous method, lambda expression, or query expression
+// Line: 17
+// Compiler options: -langversion:latest
+
+using System;
+
+public ref struct S
+{
+}
+
+class Test
+{
+ public static void Main ()
+ {
+ var s = new S ();
+
+ Action a = () => Console.WriteLine (s);
+ }
+} \ No newline at end of file
diff --git a/mcs/errors/cs8343.cs b/mcs/errors/cs8343.cs
new file mode 100644
index 00000000000..b6aa8e83a09
--- /dev/null
+++ b/mcs/errors/cs8343.cs
@@ -0,0 +1,12 @@
+// CS8343: `S': ref structs cannot implement interfaces
+// Line: 7
+// Compiler options: -langversion:latest
+
+using System;
+
+public ref struct S : IDisposable
+{
+ public void Dispose ()
+ {
+ }
+}
diff --git a/mcs/errors/cs8345-2.cs b/mcs/errors/cs8345-2.cs
new file mode 100644
index 00000000000..3f6137b1b56
--- /dev/null
+++ b/mcs/errors/cs8345-2.cs
@@ -0,0 +1,12 @@
+// CS8345: Field or auto-implemented property cannot be of type `S' unless it is an instance member of a ref struct
+// Line: 11
+// Compiler options: -langversion:latest
+
+public ref struct S
+{
+}
+
+ref struct Test
+{
+ static S field;
+} \ No newline at end of file
diff --git a/mcs/errors/cs8345.cs b/mcs/errors/cs8345.cs
new file mode 100644
index 00000000000..0b5bd05518f
--- /dev/null
+++ b/mcs/errors/cs8345.cs
@@ -0,0 +1,12 @@
+// CS8345: Field or auto-implemented property cannot be of type `S' unless it is an instance member of a ref struct
+// Line: 11
+// Compiler options: -langversion:latest
+
+public ref struct S
+{
+}
+
+struct Test
+{
+ S field;
+} \ No newline at end of file