Skip to content

Commit

Permalink
Don't assume Type is non-null
Browse files Browse the repository at this point in the history
  • Loading branch information
ryzngard committed Aug 14, 2019
1 parent cc00ecd commit 499890d
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,19 @@ protected override ImmutableArray<TaggedText> TryGetNullabilityAnalysis(Workspac
return default;
}

var typeInfo = semanticModel.GetTypeInfo(bindableParent, cancellationToken);

if (typeInfo.Type.IsValueType)
{
return default;
}

switch (symbolInfo.Symbol)
{
case IFieldSymbol { HasConstantValue: true }: return default;
case ILocalSymbol { HasConstantValue: true }: return default;
}

var typeInfo = semanticModel.GetTypeInfo(bindableParent, cancellationToken);

if (typeInfo.Type?.IsValueType == true)
{
return default;
}

string messageTemplate = null;

if (typeInfo.Nullability.FlowState == NullableFlowState.NotNull)
Expand Down

1 comment on commit 499890d

@CyrusNajmabadi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.