-
-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correctly annotate nullable generics in disabled nullable contex…
…ts (#1020)
- Loading branch information
Showing
3 changed files
with
55 additions
and
1 deletion.
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
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
25 changes: 25 additions & 0 deletions
25
...rableTest.ShouldUpgradeNullabilityOfGenericInDisabledNullableContext#Mapper.g.verified.cs
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,25 @@ | ||
//HintName: Mapper.g.cs | ||
// <auto-generated /> | ||
#nullable enable | ||
public partial class Mapper | ||
{ | ||
private partial global::System.Collections.Generic.IList<global::B?>? Map(global::System.Collections.Generic.IList<global::A?>? source) | ||
{ | ||
if (source == null) | ||
return default; | ||
var target = new global::System.Collections.Generic.List<global::B?>(source.Count); | ||
foreach (var item in source) | ||
{ | ||
target.Add(MapToB(item)); | ||
} | ||
return target; | ||
} | ||
|
||
private global::B? MapToB(global::A? source) | ||
{ | ||
if (source == null) | ||
return default; | ||
var target = new global::B(source.V); | ||
return target; | ||
} | ||
} |