Skip to content

Commit 20f8f91

Browse files
committed
Merge remote-tracking branch 'upstream/draft-v9' into alpha-v9
2 parents 2c6c680 + 131d9d0 commit 20f8f91

4 files changed

Lines changed: 38 additions & 12 deletions

File tree

standard/classes.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3083,8 +3083,11 @@ Partial methods may be defined in one part of a type declaration and implemented
30833083
30843084
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***. Otherwise, the declaration is said to be an ***implementing partial method declaration***. Across the parts of a type declaration, there may be only one defining partial method declaration with a given signature, and there may be 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:
30853085
3086-
- The declarations shall have the same modifiers (although not necessarily in the same order), method name, number of type parameters, and number of parameters. In the case of private accessibility, both shall be implicitly private (that is, with no accessibility modifier) or both shall be explicitly `private`.
3087-
- Corresponding parameters in the declarations shall have the same modifiers (although not necessarily in the same order) and the same types (modulo differences in type parameter names).
3086+
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:
3087+
3088+
- The declarations shall have the same method name, number of type parameters, and number of parameters.
3089+
- 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. In the case of private accessibility, both shall be implicitly private (that is, with no accessibility modifier) or both shall be explicitly `private`.
3090+
- 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).
30883091
- Corresponding type parameters in the declarations shall have the same constraints (modulo differences in type parameter names).
30893092
30903093
Over time, the specification for partial methods has evolved, resulting in restricted and unrestricted versions. A ***restricted partial method*** has no explicit access modifiers (and is implicitly private), has a `void` return type, and has no out parameters. An ***unrestricted partial method*** is a partial method that has explicit access modifiers, a non-`void` return type, or any out parameters.

standard/types.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -927,10 +927,13 @@ Every expression has one of three ***null state***s:
927927
928928
The ***default null state*** of an expression is determined by its type, and the state of the annotations flag when it is declared:
929929
930-
- The default null state of a nullable reference type is:
931-
- Maybe null when its declaration is in text where the annotations flag is enabled.
932-
- Not null when its declaration is in text where the annotations flag is disabled.
933-
- The default null state of a non-nullable reference type is not null.
930+
- The default state of the `null` literal ([§6.4.5.7](lexical-structure.md#6457-the-null-literal)) is maybe null.
931+
- 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.
932+
- For all other expressions:
933+
- The default null state of an expression whose type is a nullable reference type is:
934+
- Maybe null when its declaration is in text where the annotations flag is enabled.
935+
- Not null when its declaration is in text where the annotations flag is disabled.
936+
- The default null state of an expression whose type is a non-nullable reference type is not null.
934937
935938
> *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*
936939
@@ -1226,4 +1229,24 @@ A compiler may issue a warning when nullability differs in either direction in t
12261229
>
12271230
> *end example*
12281231
1232+
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.
1233+
1234+
> <!-- Example: {template:"code-in-class-lib", name:"LiftedOperator", ignoredWarnings:["CS8600"]} -->
1235+
> ```csharp
1236+
> #nullable enable
1237+
> class C
1238+
> {
1239+
> void M()
1240+
> {
1241+
> C? a = (int?)null; // No warning
1242+
> C b = (int?)null; // Warning: Possible assignment to null
1243+
> C c = 1; // No warning
1244+
> }
1245+
>
1246+
> public static implicit operator C(int v) => new C();
1247+
> }
1248+
> ```
1249+
>
1250+
> *end example*
1251+
12291252
**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)