This commit is contained in:
Siegfried Pammer 2021-09-19 18:25:01 +02:00
Родитель e9a1549f28
Коммит 1eba12b27f
3 изменённых файлов: 8 добавлений и 23 удалений

Просмотреть файл

@ -17,14 +17,14 @@
<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.4.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="3.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.9.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="3.9.0" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="16.10.56" />
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="16.9.60" />
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="16.9.20" />
<PackageReference Include="NuGet.Build.Tasks" Version="5.11.0" />
<PackageReference Include="NuGet.Build.Tasks" Version="5.9.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="5.0.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="3.1.0" />

Просмотреть файл

@ -44,11 +44,7 @@ namespace ICSharpCode.NullabilityInference
/// Visiting a condition that will decide control-flow.
/// In this mode, operations can create different flow-state onTrue/onFalse.
/// </summary>
Condition,
/// <summary>
/// Visiting descendants of a declaration expression. `var (a, b) = t;`
/// </summary>
DeclarationExpression
Condition
}
internal class EdgeBuildingOperationVisitor : OperationVisitor<EdgeBuildingContext, TypeWithNode>
@ -742,14 +738,6 @@ namespace ICSharpCode.NullabilityInference
public override TypeWithNode VisitLocalReference(ILocalReferenceOperation operation, EdgeBuildingContext argument)
{
if (argument == EdgeBuildingContext.DeclarationExpression) {
var ty = tsBuilder.CreateHelperType(operation.Type);
ty.SetName(operation.Local.Name);
localVarTypes.Add(operation.Local, ty);
localVariables.Add(operation.Local);
return ty;
}
if (!localVarTypes.TryGetValue(operation.Local, out TypeWithNode variableType)) {
variableType = typeSystem.GetSymbolType(operation.Local);
}
@ -1643,8 +1631,7 @@ namespace ICSharpCode.NullabilityInference
public override TypeWithNode VisitDeclarationExpression(IDeclarationExpressionOperation operation, EdgeBuildingContext argument)
{
// appears e.g. in `var (a, b) = tuple;`
Debug.Assert(argument == EdgeBuildingContext.LValue);
return Visit(operation.Expression, EdgeBuildingContext.DeclarationExpression);
return Visit(operation.Expression, argument);
}
public override TypeWithNode VisitDiscardOperation(IDiscardOperation operation, EdgeBuildingContext argument)
@ -1696,8 +1683,6 @@ namespace ICSharpCode.NullabilityInference
foreach (var ((lambdaParamSyntax, invokeParam), lambdaParamSymbol) in parameterList.Zip(delegateParameters).Zip(lambda.Symbol.Parameters)) {
if (lambdaParamSyntax.Type != null) {
var paramType = lambdaParamSyntax.Type.Accept(syntaxVisitor);
localVarTypes.Add(lambdaParamSymbol, paramType);
localVariables.Add(lambdaParamSymbol);
// C# 8 requires lambda parameters to exactly match the delegate type
// e.g. someEvent += delegate(object? sender, EventArgs? e)
// causes a warning that the EventArgs paramter must not be nullable.

Просмотреть файл

@ -13,6 +13,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.9.0" />
</ItemGroup>
</Project>