File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,12 @@ protected OrdinaryMethod(Context cx, IMethodSymbol init)
1818
1919 public IMethodSymbol SourceDeclaration => Symbol . OriginalDefinition ;
2020
21- public override Microsoft . CodeAnalysis . Location ReportingLocation => Symbol . GetSymbolLocation ( ) ;
21+ public override Microsoft . CodeAnalysis . Location ReportingLocation =>
22+ IsCompilerGeneratedDelegate ( )
23+ ? Symbol . ContainingType . GetSymbolLocation ( )
24+ : Symbol . GetSymbolLocation ( ) ;
25+
26+ public override bool NeedsPopulation => base . NeedsPopulation || IsCompilerGeneratedDelegate ( ) ;
2227
2328 public override void Populate ( TextWriter trapFile )
2429 {
@@ -47,6 +52,18 @@ public override void Populate(TextWriter trapFile)
4752 ExtractCompilerGenerated ( trapFile ) ;
4853 }
4954
55+ private bool IsCompilerGeneratedDelegate ( )
56+ {
57+ // Lambdas with parameter defaults or a `params` parameter are implemented
58+ // using compiler generated delegate types.
59+ if ( Symbol . MethodKind == MethodKind . DelegateInvoke &&
60+ Symbol . ContainingType is INamedTypeSymbol nt )
61+ {
62+ return nt . TypeKind == TypeKind . Delegate && nt . IsImplicitlyDeclared ;
63+ }
64+ return false ;
65+ }
66+
5067 public static new OrdinaryMethod Create ( Context cx , IMethodSymbol method )
5168 {
5269 if ( method . MethodKind == MethodKind . ReducedExtension )
You can’t perform that action at this time.
0 commit comments