diff --git a/standard/classes.md b/standard/classes.md index 168a70106..199e77de3 100644 --- a/standard/classes.md +++ b/standard/classes.md @@ -3034,7 +3034,8 @@ Partial methods shall not define access modifiers; they are implicitly private. 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: -- The declarations shall have the same modifiers (although not necessarily in the same order), method name, number of type parameters and number of parameters. +- The declarations shall have the same method name, number of type parameters, and number of parameters. +- 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. - 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). - Corresponding type parameters in the declarations shall have the same constraints (modulo differences in type parameter names). diff --git a/standard/types.md b/standard/types.md index 01b51748b..865f99dfb 100644 --- a/standard/types.md +++ b/standard/types.md @@ -869,10 +869,13 @@ Every expression has one of three ***null state***s: The ***default null state*** of an expression is determined by its type, and the state of the annotations flag when it is declared: -- The default null state of a nullable reference type is: - - Maybe null when its declaration is in text where the annotations flag is enabled. - - Not null when its declaration is in text where the annotations flag is disabled. -- The default null state of a non-nullable reference type is not null. +- The default state of the `null` literal ([§6.4.5.7](lexical-structure.md#6457-the-null-literal)) is maybe null. +- 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. +- For all other expressions: + - The default null state of an expression whose type is a nullable reference type is: + - Maybe null when its declaration is in text where the annotations flag is enabled. + - Not null when its declaration is in text where the annotations flag is disabled. + - The default null state of an expression whose type is a non-nullable reference type is not null. > *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* @@ -1168,4 +1171,24 @@ A compiler may issue a warning when nullability differs in either direction in t > > *end example* +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. + +> +> ```csharp +> #nullable enable +> class C +> { +> void M() +> { +> C? a = (int?)null; // No warning +> C b = (int?)null; // Warning: Possible assignment to null +> C c = 1; // No warning +> } +> +> public static implicit operator C(int v) => new C(); +> } +> ``` +> +> *end example* + **End of conditionally normative text** diff --git a/tools/ExampleTester.Tests/ExampleTester.Tests.csproj b/tools/ExampleTester.Tests/ExampleTester.Tests.csproj index 8cea681c1..a3f135599 100644 --- a/tools/ExampleTester.Tests/ExampleTester.Tests.csproj +++ b/tools/ExampleTester.Tests/ExampleTester.Tests.csproj @@ -7,10 +7,10 @@ - + - - + + diff --git a/tools/MarkdownConverter.Tests/MarkdownConverter.Tests.csproj b/tools/MarkdownConverter.Tests/MarkdownConverter.Tests.csproj index c821ac157..8b920b5ea 100644 --- a/tools/MarkdownConverter.Tests/MarkdownConverter.Tests.csproj +++ b/tools/MarkdownConverter.Tests/MarkdownConverter.Tests.csproj @@ -13,11 +13,11 @@ - - + + - + runtime; build; native; contentfiles; analyzers; buildtransitive all