Skip to content

Commit

Permalink
Fix failing tests:
Browse files Browse the repository at this point in the history
- Don't do analysis for speculative attributes
- Manually call TryGetThisParameter, rather than MethodThisParameter which can throw
  • Loading branch information
chsienki committed Mar 13, 2019
1 parent ce65b09 commit 72ae518
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
Expand Up @@ -261,7 +261,7 @@ protected override ImmutableArray<PendingBranch> Scan(ref bool badRegion)
_returnTypesOpt.Clear();
}
this.Diagnostics.Clear();
ParameterSymbol methodThisParameter = MethodThisParameter;
((MethodSymbol)_symbol).TryGetThisParameter(out var methodThisParameter);
this.State = TopState(); // entry point is reachable
this.regionPlace = RegionPlace.Before;
EnterParameters(); // with parameters assigned
Expand Down Expand Up @@ -293,7 +293,8 @@ protected override ImmutableArray<PendingBranch> Scan(ref bool badRegion)
BoundAttribute attribute,
DiagnosticBag diagnostics)
{
if (attribute.Constructor is null)
if (attribute.Constructor is null ||
!compilation.SyntaxTrees.Contains(attribute.SyntaxTree))
{
return;
}
Expand Down

0 comments on commit 72ae518

Please sign in to comment.