Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analyze properties with conditional attributes in patterns #51001

Merged
merged 4 commits into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal abstract partial class AbstractFlowPass<TLocalState, TLocalFunctionStat
public override BoundNode VisitSwitchStatement(BoundSwitchStatement node)
{
// dispatch to the switch sections
var (initialState, afterSwitchState) = VisitSwitchStatementDispatch(node);
var afterSwitchState = VisitSwitchStatementDispatch(node);

// visit switch sections
var switchSections = node.SwitchSections;
Expand All @@ -36,7 +36,7 @@ public override BoundNode VisitSwitchStatement(BoundSwitchStatement node)
return null;
}

protected virtual (TLocalState initialState, TLocalState afterSwitchState) VisitSwitchStatementDispatch(BoundSwitchStatement node)
protected virtual TLocalState VisitSwitchStatementDispatch(BoundSwitchStatement node)
{
// visit switch header
VisitRvalue(node.Expression);
Expand Down Expand Up @@ -77,7 +77,7 @@ protected virtual (TLocalState initialState, TLocalState afterSwitchState) Visit
Join(ref afterSwitchState, ref initialState);
}

return (initialState, afterSwitchState);
return afterSwitchState;
}

/// <summary>
Expand Down
6 changes: 6 additions & 0 deletions src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5131,6 +5131,12 @@ private void ApplyMemberPostConditions(BoundExpression? receiverOpt, MethodSymbo
return;
}

ApplyMemberPostConditions(receiverSlot, method);
}

private void ApplyMemberPostConditions(int receiverSlot, MethodSymbol method)
{
Debug.Assert(receiverSlot >= 0);
do
{
var type = method.ContainingType;
Expand Down
Loading