Skip to content

Commit 131d9d0

Browse files
BillWagnerdependabot[bot]jnm2github-actions[bot]Jon Skeet
authored
Merge v8 updates into the draft-v9 branch (#1534)
* Bump Microsoft.NET.Test.Sdk and 2 others (#1526) Bumps Microsoft.NET.Test.Sdk from 17.14.1 to 18.0.1 Bumps Newtonsoft.Json from 13.0.3 to 13.0.4 Bumps xunit.runner.visualstudio from 3.1.4 to 3.1.5 --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.0.1 dependency-type: direct:production update-type: version-update:semver-major dependency-group: dotnet - dependency-name: Newtonsoft.Json dependency-version: 13.0.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet - dependency-name: xunit.runner.visualstudio dependency-version: 3.1.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dotnet ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump Microsoft.NET.Test.Sdk, NUnit.Analyzers and NUnit3TestAdapter (#1525) Bumps Microsoft.NET.Test.Sdk from 17.14.1 to 18.0.1 Bumps NUnit.Analyzers from 4.10.0 to 4.11.2 Bumps NUnit3TestAdapter from 5.1.0 to 6.0.1 --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.0.1 dependency-type: direct:production update-type: version-update:semver-major dependency-group: dotnet - dependency-name: NUnit.Analyzers dependency-version: 4.11.2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dotnet - dependency-name: NUnit3TestAdapter dependency-version: 6.0.1 dependency-type: direct:production update-type: version-update:semver-major dependency-group: dotnet ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Address remaining nullable reference type issues (#1515) * Warning on lifted conversion w/ null Fixes item 2 in #1228 * Specify default null state of default Fixes the 3rd and 4th item in the list. * Update standard/types.md Co-authored-by: Joseph Musser <me@jnm2.com> * Apply suggestions from code review Co-authored-by: Joseph Musser <me@jnm2.com> --------- Co-authored-by: Joseph Musser <me@jnm2.com> * [create-pull-request] automated change (#1531) Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com> * Add an exception to the requirement that partial method declarations have the same modifiers (#1521) * Add an exception to the requirement that partial method declarations have the same modifiers * Update standard/classes.md --------- Co-authored-by: Jon Skeet <jonskeet@google.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Joseph Musser <me@jnm2.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com> Co-authored-by: Jon Skeet <jonskeet@google.com>
2 parents a70f280 + 5efa912 commit 131d9d0

4 files changed

Lines changed: 35 additions & 11 deletions

File tree

standard/classes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3034,7 +3034,8 @@ Partial methods shall not define access modifiers; they are implicitly private.
30343034
30353035
There are two kinds of partial method declarations: If the body of the method declaration is a semicolon, the declaration is said to be a ***defining partial method declaration***. If the body is other than a semicolon, the declaration is said to be an ***implementing partial method declaration***. Across the parts of a type declaration, there shall be only one defining partial method declaration with a given signature, and there shall be at most only one implementing partial method declaration with a given signature. If an implementing partial method declaration is given, a corresponding defining partial method declaration shall exist, and the declarations shall match as specified in the following:
30363036
3037-
- The declarations shall have the same modifiers (although not necessarily in the same order), method name, number of type parameters and number of parameters.
3037+
- The declarations shall have the same method name, number of type parameters, and number of parameters.
3038+
- The declarations shall have the same modifiers (although not necessarily in the same order), with the exception of the `async` modifier which shall not appear on a defining part.
30383039
- Corresponding parameters in the declarations shall have the same modifiers (although not necessarily in the same order) and the same types, or identity convertible types (modulo differences in type parameter names).
30393040
- Corresponding type parameters in the declarations shall have the same constraints (modulo differences in type parameter names).
30403041

standard/types.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -869,10 +869,13 @@ Every expression has one of three ***null state***s:
869869
870870
The ***default null state*** of an expression is determined by its type, and the state of the annotations flag when it is declared:
871871
872-
- The default null state of a nullable reference type is:
873-
- Maybe null when its declaration is in text where the annotations flag is enabled.
874-
- Not null when its declaration is in text where the annotations flag is disabled.
875-
- The default null state of a non-nullable reference type is not null.
872+
- The default state of the `null` literal ([§6.4.5.7](lexical-structure.md#6457-the-null-literal)) is maybe null.
873+
- The default state of a default value expression ([§12.8.21](expressions.md#12821-default-value-expressions)) is not null when the type is a non-nullable value type, otherwise maybe null.
874+
- For all other expressions:
875+
- The default null state of an expression whose type is a nullable reference type is:
876+
- Maybe null when its declaration is in text where the annotations flag is enabled.
877+
- Not null when its declaration is in text where the annotations flag is disabled.
878+
- The default null state of an expression whose type is a non-nullable reference type is not null.
876879
877880
> *Note:* The *maybe default* state is used with unconstrained type parameters when the type is a non-nullable type, such as `string` and the expression `default(T)` is the null value. Because null is not in the domain for the non-nullable type, the state is maybe default. *end note*
878881
@@ -1168,4 +1171,24 @@ A compiler may issue a warning when nullability differs in either direction in t
11681171
>
11691172
> *end example*
11701173
1174+
A compiler may issue a warning when the result of a lifted conversion operator ([§10.6.2](conversions.md#1062-lifted-conversions)) is a reference type and is converted to a non-nullable reference type, since the result of a lifted conversion operator is maybe-null.
1175+
1176+
> <!-- Example: {template:"code-in-class-lib", name:"LiftedOperator", ignoredWarnings:["CS8600"]} -->
1177+
> ```csharp
1178+
> #nullable enable
1179+
> class C
1180+
> {
1181+
> void M()
1182+
> {
1183+
> C? a = (int?)null; // No warning
1184+
> C b = (int?)null; // Warning: Possible assignment to null
1185+
> C c = 1; // No warning
1186+
> }
1187+
>
1188+
> public static implicit operator C(int v) => new C();
1189+
> }
1190+
> ```
1191+
>
1192+
> *end example*
1193+
11711194
**End of conditionally normative text**

tools/ExampleTester.Tests/ExampleTester.Tests.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
1111
<PackageReference Include="NUnit" Version="4.4.0" />
12-
<PackageReference Include="NUnit.Analyzers" Version="4.10.0" PrivateAssets="all" />
13-
<PackageReference Include="NUnit3TestAdapter" Version="5.1.0" />
12+
<PackageReference Include="NUnit.Analyzers" Version="4.11.2" PrivateAssets="all" />
13+
<PackageReference Include="NUnit3TestAdapter" Version="6.0.1" />
1414
<PackageReference Include="Shouldly" Version="4.3.0" />
1515
</ItemGroup>
1616

tools/MarkdownConverter.Tests/MarkdownConverter.Tests.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
</ItemGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
17-
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
16+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
17+
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
1818
<PackageReference Include="XMLUnit.Core" Version="2.11.1" />
1919
<PackageReference Include="xunit" Version="2.9.3" />
20-
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4">
20+
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
2121
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2222
<PrivateAssets>all</PrivateAssets>
2323
</PackageReference>

0 commit comments

Comments
 (0)