Skip to content

Commit cd21772

Browse files
committed
Fix assertion in HandleThrow()
1 parent e2fad8f commit cd21772

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

NullabilityInference/NodeBuildingSyntaxVisitor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,8 @@ private void HandleThrow(ExpressionSyntax? exceptionSyntax)
507507
if (exceptionSyntax is ObjectCreationExpressionSyntax oce) {
508508
if (IsArgumentNullException(oce.Type) && oce.ArgumentList?.Arguments.Count == 1 && IsParameterName(oce.ArgumentList.Arguments.Single(), out var param)) {
509509
if (parameterTypes.TryGetValue(param, out var paramType)) {
510-
// ignore value type parameters (or unconstrained type parameters)
511-
if (paramType.Node.NullType != NullType.Oblivious) {
510+
// ignore value type parameters (or parameters that were already annotated)
511+
if (paramType.Node.ReplacedWith.NullType == NullType.Infer) {
512512
paramType.Node.ReplaceWith(typeSystem.NonNullNode);
513513
}
514514
}

0 commit comments

Comments
 (0)