Skip to content

Commit b637ac5

Browse files
authored
Update test templates for V9 (#1451)
* Update test templates for V9 Update the language version in all our testing templates for C# 9. Required for testing PRs for V9 features. * revert changes where global usings are in force. * note changed C# 9 behavior * one more test failure. * Use V9 in this template * Change expected error.
1 parent 77f5e49 commit b637ac5

File tree

12 files changed

+14
-13
lines changed

12 files changed

+14
-13
lines changed

standard/attributes.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ A generic class declaration shall not use `System.Attribute` as a direct or indi
2020

2121
> *Example*:
2222
>
23-
> <!-- Example: {template:"standalone-lib", name:"AttributeCantBeGeneric", expectedErrors:["CS8400"], ignoredWarnings:["CS0169"]} -->
23+
> <!-- Example: {template:"standalone-lib", name:"AttributeCantBeGeneric", expectedErrors:["CS8773"], ignoredWarnings:["CS0169"]} -->
2424
> ```csharp
2525
> public class B : Attribute {}
2626
> public class C<T> : B {} // Error – generic cannot be an attribute
@@ -982,7 +982,8 @@ Specifies that a non-nullable return value may be null.
982982
983983
> *Example*: Consider the following generic method:
984984
>
985-
> <!-- Example: {template:"code-in-class-lib", name:"MaybeNull1Attribute", replaceEllipsis:true, customEllipsisReplacements: ["return default;"], expectedErrors:["CS8627"]} -->
985+
> <!-- TODO: This sample no longer generates the error in C# 9. This could be part of the new nullable constraints. Was: , expectedErrors:["CS8627"]-->
986+
> <!-- Example: {template:"code-in-class-lib", name:"MaybeNull1Attribute", replaceEllipsis:true, customEllipsisReplacements: ["return default;"]} -->
986987
> ```csharp
987988
> #nullable enable
988989
> public T? Find<T>(IEnumerable<T> sequence, Func<T, bool> predicate) { ... }

tools/example-templates/code-in-class-lib-without-using/Project.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<AssemblyName>$example-name</AssemblyName>
66
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
77
<Nullable>annotations</Nullable>
8-
<LangVersion>8</LangVersion>
8+
<LangVersion>9</LangVersion>
99
</PropertyGroup>
1010

1111
</Project>

tools/example-templates/code-in-class-lib/Project.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<AssemblyName>$example-name</AssemblyName>
66
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
77
<Nullable>annotations</Nullable>
8-
<LangVersion>8</LangVersion>
8+
<LangVersion>9</LangVersion>
99
</PropertyGroup>
1010

1111
</Project>

tools/example-templates/code-in-main-without-using/Project.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Nullable>annotations</Nullable>
77
<AssemblyName>$example-name</AssemblyName>
88
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
9-
<LangVersion>8</LangVersion>
9+
<LangVersion>9</LangVersion>
1010
</PropertyGroup>
1111

1212
</Project>

tools/example-templates/code-in-main/Project.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Nullable>annotations</Nullable>
77
<AssemblyName>$example-name</AssemblyName>
88
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
9-
<LangVersion>8</LangVersion>
9+
<LangVersion>9</LangVersion>
1010
</PropertyGroup>
1111

1212
</Project>

tools/example-templates/code-in-partial-class/Project.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<AssemblyName>$example-name</AssemblyName>
77
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
88
<Nullable>annotations</Nullable>
9-
<LangVersion>8</LangVersion>
9+
<LangVersion>9</LangVersion>
1010
</PropertyGroup>
1111

1212
</Project>

tools/example-templates/extern-lib/ExampleProject.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<EnableDefaultItems>false</EnableDefaultItems>
66
<NoWarn>CS0169</NoWarn>
77
<Nullable>annotations</Nullable>
8-
<LangVersion>8</LangVersion>
8+
<LangVersion>9</LangVersion>
99
</PropertyGroup>
1010

1111
<ItemGroup>

tools/example-templates/extern-lib/ExternN2.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>net6.0</TargetFramework>
55
<EnableDefaultItems>false</EnableDefaultItems>
66
<Nullable>annotations</Nullable>
7-
<LangVersion>8</LangVersion>
7+
<LangVersion>9</LangVersion>
88
</PropertyGroup>
99

1010
<ItemGroup>

tools/example-templates/extern-lib/ExternR1.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>net6.0</TargetFramework>
55
<EnableDefaultItems>false</EnableDefaultItems>
66
<Nullable>annotations</Nullable>
7-
<LangVersion>8</LangVersion>
7+
<LangVersion>9</LangVersion>
88
</PropertyGroup>
99

1010
<ItemGroup>

tools/example-templates/extern-lib/ExternX.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>net6.0</TargetFramework>
55
<EnableDefaultItems>false</EnableDefaultItems>
66
<Nullable>annotations</Nullable>
7-
<LangVersion>8</LangVersion>
7+
<LangVersion>9</LangVersion>
88
</PropertyGroup>
99

1010
<ItemGroup>

0 commit comments

Comments
 (0)