diff options
author | Jb Evain <jbevain@gmail.com> | 2018-07-14 14:32:26 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2018-07-14 14:32:26 +0300 |
commit | 0f87948a6894b935ac955f5f4fa955e00c09d25c (patch) | |
tree | 86ee8caef8d9525ca1036b445513ba9d3fb903e1 /mcs/errors | |
parent | ff26178dd641755c47304ae133ddf75f6e17a3a3 (diff) |
[mcs] Constrain expression bodied accessors to C# 7 (#9547)
* [mcs] Expression body for accessors are a C# 7 feature
* [mcs] Add tests for constraining expression accessors to C# 7
Diffstat (limited to 'mcs/errors')
-rw-r--r-- | mcs/errors/cs1644-64.cs | 13 | ||||
-rw-r--r-- | mcs/errors/cs1644-65.cs | 13 | ||||
-rw-r--r-- | mcs/errors/cs1644-66.cs | 17 |
3 files changed, 43 insertions, 0 deletions
diff --git a/mcs/errors/cs1644-64.cs b/mcs/errors/cs1644-64.cs new file mode 100644 index 00000000000..88917a0a5d5 --- /dev/null +++ b/mcs/errors/cs1644-64.cs @@ -0,0 +1,13 @@ +// CS1644: Feature `expression body property accessor' cannot be used because it is not part of the C# 6.0 language specification +// Line: 11 +// Compiler options: -langversion:6 + +using System; + +class C +{ + public int Integer + { + get => 0; + } +}
\ No newline at end of file diff --git a/mcs/errors/cs1644-65.cs b/mcs/errors/cs1644-65.cs new file mode 100644 index 00000000000..dea648b7846 --- /dev/null +++ b/mcs/errors/cs1644-65.cs @@ -0,0 +1,13 @@ +// CS1644: Feature `expression body property accessor' cannot be used because it is not part of the C# 6.0 language specification +// Line: 11 +// Compiler options: -langversion:6 + +using System; + +class C +{ + public int this[int i] + { + get => i; + } +}
\ No newline at end of file diff --git a/mcs/errors/cs1644-66.cs b/mcs/errors/cs1644-66.cs new file mode 100644 index 00000000000..3f393b50d30 --- /dev/null +++ b/mcs/errors/cs1644-66.cs @@ -0,0 +1,17 @@ +// CS1644: Feature `expression body event accessor' cannot be used because it is not part of the C# 6.0 language specification +// Line: 11 +// Compiler options: -langversion:6 + +using System; + +class C +{ + public event EventHandler Event + { + add => Ignore (); + } + + static void Ignore () + { + } +}
\ No newline at end of file |