From 72ae5183211207ec97ffd46397a966081ffafc67 Mon Sep 17 00:00:00 2001 From: Chris Sienkiewicz Date: Thu, 7 Mar 2019 16:10:46 -0800 Subject: [PATCH] Fix failing tests: - Don't do analysis for speculative attributes - Manually call TryGetThisParameter, rather than MethodThisParameter which can throw --- src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs b/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs index a2f743edae8..819ed90a5ac 100644 --- a/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs +++ b/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs @@ -261,7 +261,7 @@ protected override ImmutableArray 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 @@ -293,7 +293,8 @@ protected override ImmutableArray Scan(ref bool badRegion) BoundAttribute attribute, DiagnosticBag diagnostics) { - if (attribute.Constructor is null) + if (attribute.Constructor is null || + !compilation.SyntaxTrees.Contains(attribute.SyntaxTree)) { return; } -- GitLab