File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -293,7 +293,7 @@ public override TypeWithNode VisitParameter(ParameterSyntax node)
293293 parameterTypes . Add ( symbol , type ) ;
294294 typeSystem . AddSymbolType ( symbol , type ) ;
295295
296- if ( symbol . RefKind == RefKind . Out && ( symbol . ContainingSymbol as IMethodSymbol ) ? . EffectiveReturnType ( ) . SpecialType == SpecialType . System_Boolean ) {
296+ if ( symbol . RefKind == RefKind . Out && CanUseOutParamFlow ( symbol . ContainingSymbol as IMethodSymbol ) ) {
297297 typeSystem . RegisterOutParamFlowNodes ( symbol ) ;
298298 }
299299 }
@@ -302,6 +302,19 @@ public override TypeWithNode VisitParameter(ParameterSyntax node)
302302 return typeSystem . VoidType ;
303303 }
304304
305+ private bool CanUseOutParamFlow ( IMethodSymbol ? method )
306+ {
307+ if ( method == null )
308+ return false ;
309+ if ( method . ContainingSymbol is IMethodSymbol ) {
310+ var compilation = ( CSharpCompilation ) semanticModel . Compilation ;
311+ if ( compilation . LanguageVersion <= LanguageVersion . CSharp8 )
312+ return false ; // C# 8 does not support attributes on local function parameters
313+ }
314+ return method . EffectiveReturnType ( ) . SpecialType == SpecialType . System_Boolean ;
315+ }
316+
317+
305318 public override TypeWithNode VisitNameMemberCref ( NameMemberCrefSyntax node )
306319 {
307320 Mapping . AddCrefNode ( node ) ;
You can’t perform that action at this time.
0 commit comments