Skip to content

Commit 32fc26a

Browse files
Reapply "Update to using simple untyped lambdas (dotnet#78732)"
This reverts commit 71cc05d.
1 parent b9f8bfd commit 32fc26a

File tree

18 files changed

+67
-69
lines changed

18 files changed

+67
-69
lines changed

src/EditorFeatures/Test/EditAndContinue/EditAndContinueLanguageServiceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ await localWorkspace.ChangeSolutionAsync(localWorkspace.CurrentSolution
143143

144144
// EnterBreakStateAsync
145145

146-
mockEncService.BreakStateOrCapabilitiesChangedImpl = (bool? inBreakState) =>
146+
mockEncService.BreakStateOrCapabilitiesChangedImpl = inBreakState =>
147147
{
148148
Assert.True(inBreakState);
149149
};

src/Features/CSharp/Portable/ConvertLinq/CSharpConvertLinqQueryToForEachProvider.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,8 +760,7 @@ private bool TryConvertIfInReturnStatement(
760760
// }
761761
//
762762
// yield break;
763-
var statements = GenerateStatements((ExpressionSyntax expression)
764-
=> YieldStatement(SyntaxKind.YieldReturnStatement, expression), queryExpressionProcessingInfo);
763+
var statements = GenerateStatements(expression => YieldStatement(SyntaxKind.YieldReturnStatement, expression), queryExpressionProcessingInfo);
765764

766765
// add an yield break to avoid throws after the return.
767766
var yieldBreakStatement = YieldStatement(SyntaxKind.YieldBreakStatement);

src/Features/CSharpTest/Copilot/CSharpImplementNotImplementedExceptionFixProviderTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public interface IMathService
176176
}
177177
.WithMockCopilotService(copilotService =>
178178
{
179-
copilotService.SetupFixAll = (Document document, ImmutableDictionary<SyntaxNode, ImmutableArray<ReferencedSymbol>> memberReferences, CancellationToken cancellationToken) =>
179+
copilotService.SetupFixAll = (document, memberReferences, cancellationToken) =>
180180
{
181181
// Create a map of method/property implementations
182182
var implementationMap = new Dictionary<string, string>

src/Features/Test/EditAndContinue/RemoteEditAndContinueServiceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ await localWorkspace.ChangeSolutionAsync(localWorkspace.CurrentSolution
154154

155155
// BreakStateChanged
156156

157-
mockEncService.BreakStateOrCapabilitiesChangedImpl = (bool? inBreakState) =>
157+
mockEncService.BreakStateOrCapabilitiesChangedImpl = inBreakState =>
158158
{
159159
Assert.True(inBreakState);
160160
};

src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Utilities/AbstractLanguageServerClientTests.TestLspClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Action<int, string> GetMessageLogger(string method)
162162
{
163163
var logger = _loggerFactory.CreateLogger($"LSP {method}");
164164

165-
return (int type, string message) =>
165+
return (type, message) =>
166166
{
167167
var logLevel = (MessageType)type switch
168168
{

src/RoslynAnalyzers/Utilities.UnitTests/FlowAnalysis/Analysis/PropertySetAnalysis/PropertySetAnalysisTests.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public static void StaticMethod(TestTypeToTrack staticMethodParameter)
224224
new PropertyMapperCollection(
225225
new PropertyMapper( // Definitely null => unflagged, definitely non-null => flagged, otherwise => maybe.
226226
"AString",
227-
(PointsToAbstractValue pointsToAbstractValue) =>
227+
pointsToAbstractValue =>
228228
{
229229
return pointsToAbstractValue.NullState switch
230230
{
@@ -237,7 +237,7 @@ public static void StaticMethod(TestTypeToTrack staticMethodParameter)
237237
new HazardousUsageEvaluatorCollection(
238238
new HazardousUsageEvaluator( // When TypeToTrack.Method() is invoked, need to evaluate its state.
239239
"Method",
240-
(IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) =>
240+
(methodSymbol, abstractValue) =>
241241
{
242242
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
243243

@@ -253,7 +253,7 @@ public static void StaticMethod(TestTypeToTrack staticMethodParameter)
253253
"OtherClass",
254254
"OtherMethod",
255255
"t",
256-
(IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) =>
256+
(methodSymbol, abstractValue) =>
257257
{
258258
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
259259

@@ -270,7 +270,7 @@ public static void StaticMethod(TestTypeToTrack staticMethodParameter)
270270
"OtherClass",
271271
"StaticMethod",
272272
"staticMethodParameter",
273-
(IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) =>
273+
(methodSymbol, abstractValue) =>
274274
{
275275
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
276276

@@ -399,7 +399,7 @@ void TestMethod()
399399
new(
400400
"TestTypeToTrackWithConstructor",
401401
new ConstructorMapper(
402-
(IMethodSymbol method, IReadOnlyList<PointsToAbstractValue> argumentPointsToAbstractValues) =>
402+
(method, argumentPointsToAbstractValues) =>
403403
{
404404
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
405405
PropertySetAbstractValueKind kind = PropertySetAbstractValueKind.Unknown;
@@ -420,7 +420,7 @@ void TestMethod()
420420
new PropertyMapperCollection(
421421
new PropertyMapper( // Definitely null => unflagged, definitely non-null => flagged, otherwise => maybe.
422422
"AString",
423-
(PointsToAbstractValue pointsToAbstractValue) =>
423+
pointsToAbstractValue =>
424424
{
425425
return pointsToAbstractValue.NullState switch
426426
{
@@ -433,7 +433,7 @@ void TestMethod()
433433
new HazardousUsageEvaluatorCollection(
434434
new HazardousUsageEvaluator(
435435
"Method",
436-
(IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) =>
436+
(methodSymbol, abstractValue) =>
437437
{
438438
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
439439

@@ -525,14 +525,14 @@ void TestMethod()
525525
new PropertyMapperCollection(
526526
new PropertyMapper(
527527
"AnEnum",
528-
(ValueContentAbstractValue valueContentAbstractValue) =>
528+
valueContentAbstractValue =>
529529
{
530530
return PropertySetCallbacks.EvaluateLiteralValues(valueContentAbstractValue, v => v is not null && v.Equals(0));
531531
})),
532532
new HazardousUsageEvaluatorCollection(
533533
new HazardousUsageEvaluator( // When TypeToTrack.Method() is invoked, need to evaluate its state.
534534
"Method",
535-
(IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) =>
535+
(methodSymbol, abstractValue) =>
536536
{
537537
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
538538

@@ -586,7 +586,7 @@ void TestMethod()
586586
new(
587587
"TestTypeToTrackWithConstructor",
588588
new ConstructorMapper(
589-
(IMethodSymbol method, IReadOnlyList<ValueContentAbstractValue> argumentValueContentAbstractValues, IReadOnlyList<PointsToAbstractValue> argumentPointsToAbstractValues) =>
589+
(method, argumentValueContentAbstractValues, argumentPointsToAbstractValues) =>
590590
{
591591
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
592592

@@ -598,14 +598,14 @@ void TestMethod()
598598
new PropertyMapperCollection(
599599
new PropertyMapper(
600600
"AnEnum",
601-
(ValueContentAbstractValue valueContentAbstractValue) =>
601+
valueContentAbstractValue =>
602602
{
603603
return PropertySetCallbacks.EvaluateLiteralValues(valueContentAbstractValue, v => v is not null && v.Equals(0));
604604
})),
605605
new HazardousUsageEvaluatorCollection(
606606
new HazardousUsageEvaluator( // When TypeToTrack.Method() is invoked, need to evaluate its state.
607607
"Method",
608-
(IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) =>
608+
(methodSymbol, abstractValue) =>
609609
{
610610
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
611611

@@ -663,22 +663,22 @@ void TestMethod()
663663
new PropertyMapperCollection(
664664
new PropertyMapper(
665665
"AString",
666-
(ValueContentAbstractValue valueContentAbstractValue) =>
666+
valueContentAbstractValue =>
667667
{
668668
return PropertySetCallbacks.EvaluateLiteralValues(
669669
valueContentAbstractValue,
670670
v => (v as string)?.StartsWith("T", StringComparison.Ordinal) == true);
671671
}),
672672
new PropertyMapper(
673673
"AnEnum",
674-
(ValueContentAbstractValue valueContentAbstractValue) =>
674+
valueContentAbstractValue =>
675675
{
676676
return PropertySetCallbacks.EvaluateLiteralValues(valueContentAbstractValue, v => v is not null && v.Equals(2));
677677
})),
678678
new HazardousUsageEvaluatorCollection(
679679
new HazardousUsageEvaluator(
680680
"Method",
681-
(IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) =>
681+
(methodSymbol, abstractValue) =>
682682
{
683683
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
684684

@@ -823,7 +823,7 @@ void TestMethod()
823823
new(
824824
"TestTypeToTrackWithConstructor",
825825
new ConstructorMapper(
826-
(IMethodSymbol constructorMethodSymbol, IReadOnlyList<PointsToAbstractValue> argumentPointsToAbstractValues) =>
826+
(constructorMethodSymbol, argumentPointsToAbstractValues) =>
827827
{
828828
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
829829

@@ -845,7 +845,7 @@ void TestMethod()
845845
new PropertyMapperCollection(
846846
new PropertyMapper(
847847
"AnObject",
848-
(PointsToAbstractValue pointsToAbstractValue) =>
848+
pointsToAbstractValue =>
849849
{
850850
// Better to compare LocationTypeOpt to INamedTypeSymbol, but for this demonstration, just using MetadataName.
851851
PropertySetAbstractValueKind kind;
@@ -865,7 +865,7 @@ void TestMethod()
865865
new HazardousUsageEvaluatorCollection(
866866
new HazardousUsageEvaluator( // When TypeToTrack.Method() is invoked, need to evaluate its state.
867867
"Method",
868-
(IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) =>
868+
(methodSymbol, abstractValue) =>
869869
{
870870
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
871871

@@ -946,9 +946,9 @@ void TestMethod()
946946
new(
947947
"TestTypeToTrackWithConstructor",
948948
new ConstructorMapper(
949-
(IMethodSymbol constructorMethodSymbol,
950-
IReadOnlyList<ValueContentAbstractValue> argumentValueContentAbstractValues,
951-
IReadOnlyList<PointsToAbstractValue> argumentPointsToAbstractValues) =>
949+
(constructorMethodSymbol,
950+
argumentValueContentAbstractValues,
951+
argumentPointsToAbstractValues) =>
952952
{
953953
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
954954

@@ -960,7 +960,7 @@ void TestMethod()
960960
new PropertyMapperCollection(
961961
new PropertyMapper(
962962
"AString",
963-
(ValueContentAbstractValue valueContentAbstractValue) =>
963+
valueContentAbstractValue =>
964964
{
965965
return PropertySetCallbacks.EvaluateLiteralValues(
966966
valueContentAbstractValue,
@@ -969,7 +969,7 @@ void TestMethod()
969969
new HazardousUsageEvaluatorCollection(
970970
new HazardousUsageEvaluator( // When TypeToTrackWithConstructor.Method() is invoked, need to evaluate its state.
971971
"Method",
972-
(IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) =>
972+
(methodSymbol, abstractValue) =>
973973
{
974974
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
975975

@@ -1038,7 +1038,7 @@ TestTypeToTrackWithConstructor GetTestType()
10381038
new PropertyMapperCollection(
10391039
new PropertyMapper( // Definitely null => unflagged, definitely non-null => flagged, otherwise => maybe.
10401040
"AString",
1041-
(PointsToAbstractValue pointsToAbstractValue) =>
1041+
pointsToAbstractValue =>
10421042
{
10431043
return pointsToAbstractValue.NullState switch
10441044
{
@@ -1051,7 +1051,7 @@ TestTypeToTrackWithConstructor GetTestType()
10511051
new HazardousUsageEvaluatorCollection(
10521052
new HazardousUsageEvaluator(
10531053
HazardousUsageEvaluatorKind.Return,
1054-
(PropertySetAbstractValue abstractValue) =>
1054+
abstractValue =>
10551055
{
10561056
// With only one property being tracked, this is straightforward.
10571057
return abstractValue[0] switch
@@ -1142,7 +1142,7 @@ object TestMethod()
11421142
new PropertyMapperCollection(
11431143
new PropertyMapper( // Definitely null => unflagged, definitely non-null => flagged, otherwise => maybe.
11441144
"AString",
1145-
(PointsToAbstractValue pointsToAbstractValue) =>
1145+
pointsToAbstractValue =>
11461146
{
11471147
return pointsToAbstractValue.NullState switch
11481148
{
@@ -1155,7 +1155,7 @@ object TestMethod()
11551155
propertyIndex: 0), // Both AString and AnObject point to index 0.
11561156
new PropertyMapper( // Definitely null => unflagged, definitely non-null => flagged, otherwise => maybe.
11571157
"AnObject",
1158-
(PointsToAbstractValue pointsToAbstractValue) =>
1158+
pointsToAbstractValue =>
11591159
{
11601160
return pointsToAbstractValue.NullState switch
11611161
{
@@ -1169,7 +1169,7 @@ object TestMethod()
11691169
new HazardousUsageEvaluatorCollection(
11701170
new HazardousUsageEvaluator( // When TypeToTrack.Method() is invoked, need to evaluate its state.
11711171
"Method",
1172-
(IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) =>
1172+
(methodSymbol, abstractValue) =>
11731173
{
11741174
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
11751175

src/RoslynAnalyzers/Utilities/Compiler/Options/AbstractCategorizedAnalyzerConfigOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public T GetOptionValue<T>(string optionName, SyntaxTree? tree, DiagnosticDescri
3434
optionName,
3535
kind,
3636
rule,
37-
static (string s, TryParseValue<T> tryParseValue, [MaybeNullWhen(returnValue: false)] out T parsedValue) => tryParseValue(s, out parsedValue),
37+
static (s, tryParseValue, [MaybeNullWhen(returnValue: false)] out parsedValue) => tryParseValue(s, out parsedValue),
3838
tryParseValue,
3939
defaultValue,
4040
out var value))

src/RoslynAnalyzers/Utilities/Compiler/Options/AggregateCategorizedAnalyzerConfigOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public T GetOptionValue<T>(string optionName, SyntaxTree? tree, DiagnosticDescri
8888
kind,
8989
tree,
9090
rule,
91-
static (string s, TryParseValue<T> tryParseValue, [MaybeNullWhen(returnValue: false)] out T parsedValue) => tryParseValue(s, out parsedValue),
91+
static (s, tryParseValue, [MaybeNullWhen(returnValue: false)] out parsedValue) => tryParseValue(s, out parsedValue),
9292
tryParseValue,
9393
defaultValue,
9494
out var value))

src/RoslynAnalyzers/Utilities/Compiler/Options/AnalyzerOptionsExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private static TEnum GetFlagsEnumOptionValue<TEnum>(
141141
var analyzerConfigOptions = options.GetOrComputeCategorizedAnalyzerConfigOptions(compilation);
142142
return analyzerConfigOptions.GetOptionValue(
143143
optionName, tree, rule,
144-
tryParseValue: static (string value, out TEnum result) => Enum.TryParse(value, ignoreCase: true, result: out result),
144+
tryParseValue: static (value, out result) => Enum.TryParse(value, ignoreCase: true, result: out result),
145145
defaultValue: defaultValue);
146146
}
147147

src/RoslynAnalyzers/Utilities/FlowAnalysis/FlowAnalysis/Analysis/DisposeAnalysis/DisposeAnalysis.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ private DisposeAnalysis(DisposeAnalysisDomain analysisDomain, DisposeDataFlowOpe
7373
defaultPointsToAnalysisKind),
7474
performCopyAnalysis: analyzerOptions.GetCopyAnalysisOption(rule, owningSymbol, wellKnownTypeProvider.Compilation,
7575
defaultValue: performCopyAnalysisIfNotUserConfigured),
76-
isDisposableTypeNotRequiringToBeDisposed: (ITypeSymbol typeSymbol) =>
77-
disposeAnalysisHelper?.IsDisposableTypeNotRequiringToBeDisposed(typeSymbol) == true
76+
isDisposableTypeNotRequiringToBeDisposed: typeSymbol => disposeAnalysisHelper?.IsDisposableTypeNotRequiringToBeDisposed(typeSymbol) == true
7877
|| analyzerOptions.IsConfiguredToSkipAnalysis(rule, typeSymbol, owningSymbol, wellKnownTypeProvider.Compilation),
7978
out pointsToAnalysisResult);
8079
}

0 commit comments

Comments
 (0)