@@ -3767,6 +3767,11 @@ internal SafeContext GetRefEscape(BoundExpression expr, SafeContext localScopeDe
37673767 {
37683768 var call = ( BoundCall ) expr ;
37693769
3770+ if ( call . IsErroneousNode )
3771+ {
3772+ return SafeContext . CallingMethod ;
3773+ }
3774+
37703775 var methodSymbol = call . Method ;
37713776 if ( methodSymbol . RefKind == RefKind . None )
37723777 {
@@ -3826,6 +3831,11 @@ internal SafeContext GetRefEscape(BoundExpression expr, SafeContext localScopeDe
38263831 return SafeContext . CallingMethod ;
38273832
38283833 case BoundCall call :
3834+ if ( call . IsErroneousNode )
3835+ {
3836+ return SafeContext . CallingMethod ;
3837+ }
3838+
38293839 var methodSymbol = call . Method ;
38303840 if ( methodSymbol . RefKind == RefKind . None )
38313841 {
@@ -4049,6 +4059,11 @@ internal bool CheckRefEscape(SyntaxNode node, BoundExpression expr, SafeContext
40494059 {
40504060 var call = ( BoundCall ) expr ;
40514061
4062+ if ( call . IsErroneousNode )
4063+ {
4064+ return true ;
4065+ }
4066+
40524067 var methodSymbol = call . Method ;
40534068 if ( methodSymbol . RefKind == RefKind . None )
40544069 {
@@ -4114,6 +4129,11 @@ internal bool CheckRefEscape(SyntaxNode node, BoundExpression expr, SafeContext
41144129 return true ;
41154130
41164131 case BoundCall call :
4132+ if ( call . IsErroneousNode )
4133+ {
4134+ return true ;
4135+ }
4136+
41174137 var methodSymbol = call . Method ;
41184138 if ( methodSymbol . RefKind == RefKind . None )
41194139 {
@@ -4411,6 +4431,11 @@ internal SafeContext GetValEscape(BoundExpression expr, SafeContext localScopeDe
44114431 {
44124432 var call = ( BoundCall ) expr ;
44134433
4434+ if ( call . IsErroneousNode )
4435+ {
4436+ return SafeContext . CallingMethod ;
4437+ }
4438+
44144439 return GetInvocationEscapeScope (
44154440 MethodInvocationInfo . FromCall ( call ) ,
44164441 localScopeDepth ,
@@ -4457,6 +4482,11 @@ internal SafeContext GetValEscape(BoundExpression expr, SafeContext localScopeDe
44574482 return localScopeDepth ;
44584483
44594484 case BoundCall call :
4485+ if ( call . IsErroneousNode )
4486+ {
4487+ return SafeContext . CallingMethod ;
4488+ }
4489+
44604490 return GetInvocationEscapeScope (
44614491 MethodInvocationInfo . FromCall ( call , implicitIndexerAccess . Receiver ) ,
44624492 localScopeDepth ,
@@ -5088,6 +5118,11 @@ internal bool CheckValEscape(SyntaxNode node, BoundExpression expr, SafeContext
50885118 case BoundKind . Call :
50895119 {
50905120 var call = ( BoundCall ) expr ;
5121+ if ( call . IsErroneousNode )
5122+ {
5123+ return true ;
5124+ }
5125+
50915126 var methodSymbol = call . Method ;
50925127
50935128 return CheckInvocationEscape (
@@ -5152,6 +5187,11 @@ internal bool CheckValEscape(SyntaxNode node, BoundExpression expr, SafeContext
51525187 return false ;
51535188
51545189 case BoundCall call :
5190+ if ( call . IsErroneousNode )
5191+ {
5192+ return true ;
5193+ }
5194+
51555195 var methodSymbol = call . Method ;
51565196
51575197 return CheckInvocationEscape (
@@ -5826,7 +5866,7 @@ SafeContext getPartsScope(BoundInterpolatedString interpolatedString, SafeContex
58265866
58275867 foreach ( var part in interpolatedString . Parts )
58285868 {
5829- if ( part is not BoundCall call )
5869+ if ( part is not BoundCall { IsErroneousNode : false } call )
58305870 {
58315871 // Dynamic calls cannot have ref struct parameters.
58325872 continue ;
@@ -5868,7 +5908,7 @@ bool checkParts(BoundInterpolatedString interpolatedString, SafeContext escapeFr
58685908 {
58695909 foreach ( var part in interpolatedString . Parts )
58705910 {
5871- if ( part is not BoundCall call )
5911+ if ( part is not BoundCall { IsErroneousNode : false } call )
58725912 {
58735913 // Dynamic calls cannot have ref struct parameters.
58745914 continue ;
0 commit comments