@@ -122,7 +122,7 @@ private UnboundLambda AnalyzeAnonymousFunction(
122
122
if ( parameterSyntaxListOpt != null )
123
123
{
124
124
var parameterSyntaxList = parameterSyntaxListOpt . Value ;
125
- var hasExplicitlyTypedParameterList = parameterSyntaxList . All ( static p => p . Type != null ) ;
125
+ var hasExplicitlyTypedParameterList = parameterSyntaxList . Any ( static p => p . Type != null ) ;
126
126
127
127
var typesBuilder = ArrayBuilder < TypeWithAnnotations > . GetInstance ( ) ;
128
128
var refKindsBuilder = ArrayBuilder < RefKind > . GetInstance ( ) ;
@@ -176,7 +176,11 @@ private UnboundLambda AnalyzeAnonymousFunction(
176
176
continue ;
177
177
}
178
178
179
- var type = p . Type is not null ? BindType ( p . Type , diagnostics ) : default ;
179
+ var type = p . Type is not null
180
+ ? BindType ( p . Type , diagnostics )
181
+ : hasExplicitlyTypedParameterList
182
+ ? TypeWithAnnotations . Create ( CreateErrorType ( ) )
183
+ : default ;
180
184
181
185
var refKind = ParameterHelpers . GetModifiers ( p . Modifiers , out _ , out var paramsKeyword , out _ , out var scope ) ;
182
186
var isParams = paramsKeyword . Kind ( ) != SyntaxKind . None ;
@@ -189,7 +193,7 @@ private UnboundLambda AnalyzeAnonymousFunction(
189
193
owner : null , p , ordinal : i , lastParameterIndex : n - 1 , isParams : isParams , type ,
190
194
refKind , containingSymbol : null , thisKeyword : default , paramsKeyword : paramsKeyword , firstDefault , diagnostics ) ;
191
195
192
- var isLastParameter = parameterCount == parameterSyntaxListOpt . Value . Count ;
196
+ var isLastParameter = parameterCount == parameterSyntaxList . Count ;
193
197
if ( isLastParameter && paramsKeyword . Kind ( ) != SyntaxKind . None && ! type . IsDefault && type . IsSZArray ( ) )
194
198
{
195
199
ReportUseSiteDiagnosticForSynthesizedAttribute ( Compilation ,
@@ -206,7 +210,7 @@ private UnboundLambda AnalyzeAnonymousFunction(
206
210
defaultValueBuilder . Add ( p . Default ) ;
207
211
}
208
212
209
- discardsOpt = computeDiscards ( parameterSyntaxListOpt . Value , underscoresCount ) ;
213
+ discardsOpt = computeDiscards ( parameterSyntaxList , underscoresCount ) ;
210
214
211
215
// Only include the types if *all* the parameters had types. Otherwise, if there were no parameter
212
216
// types (or a mix of typed and untyped parameters) include no types. Note, in the latter case we will
0 commit comments