Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
1 parent
ff26178
commit 0f87948
Showing
4 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 () | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters