提交 42415c00 编写于 作者: N Neal Gafter

Fix up merge

上级 ea2b6e6c
......@@ -161,7 +161,7 @@ private BoundPattern BindDiscardPattern(DiscardPatternSyntax node, TypeSymbol in
hasErrors = true;
}
if (convertedExpression.Type == null && constantValueOpt != ConstantValue.Null)
if (convertedExpression.Type is null && constantValueOpt != ConstantValue.Null)
{
Debug.Assert(hasErrors);
convertedExpression = new BoundConversion(
......@@ -812,7 +812,7 @@ private BoundPattern BindVarPattern(VarPatternSyntax node, TypeSymbol inputType,
}
TypeSymbol declType = inputType;
Symbol foundSymbol = BindTypeOrAliasOrKeyword(node.VarKeyword, node, diagnostics, out bool isVar);
Symbol foundSymbol = BindTypeOrAliasOrKeyword(node.VarKeyword, node, diagnostics, out bool isVar).NamespaceOrTypeSymbol;
if (!isVar)
{
// Give an error if there is a bindable type "var" in scope
......
......@@ -149,7 +149,7 @@ private NamespaceOrTypeOrAliasSymbolWithAnnotations BindTypeOrAliasOrKeyword(Ide
return BindTypeOrAliasOrKeyword(((IdentifierNameSyntax)syntax).Identifier, syntax, diagnostics, out isKeyword);
}
private Symbol BindTypeOrAliasOrKeyword(SyntaxToken identifier, SyntaxNode syntax, DiagnosticBag diagnostics, out bool isKeyword)
private NamespaceOrTypeOrAliasSymbolWithAnnotations BindTypeOrAliasOrKeyword(SyntaxToken identifier, SyntaxNode syntax, DiagnosticBag diagnostics, out bool isKeyword)
{
// Keywords can only be IdentifierNameSyntax
var identifierValueText = identifier.ValueText;
......@@ -246,7 +246,7 @@ private Symbol BindTypeOrAliasOrKeyword(SyntaxToken identifier, SyntaxNode synta
lookupResult.Free();
return NamespaceOrTypeOrAliasSymbolWithAnnotations.CreateUnannotated(IsNullableEnabled(syntax.Identifier), symbol);
return NamespaceOrTypeOrAliasSymbolWithAnnotations.CreateUnannotated(IsNullableEnabled(identifier), symbol);
}
// Binds the given expression syntax as Type.
......
......@@ -345,7 +345,7 @@ private DecisionDagBuilder(CSharpCompilation compilation, LabelSymbol defaultLab
BoundExpression variableAccess = declaration.VariableAccess;
if (variableAccess != null)
{
Debug.Assert(variableAccess.Type == input.Type);
Debug.Assert(variableAccess.Type.Equals(input.Type, TypeCompareKind.AllIgnoreOptions));
bindings.Add(new BoundPatternBinding(variableAccess, input));
}
else
......@@ -376,7 +376,7 @@ private DecisionDagBuilder(CSharpCompilation compilation, LabelSymbol defaultLab
ArrayBuilder<BoundDagTest> tests)
{
MakeCheckNotNull(input, syntax, tests);
if (input.Type != type)
if (!input.Type.Equals(type, TypeCompareKind.AllIgnoreOptions))
{
TypeSymbol inputType = input.Type.StrippedType(); // since a null check has already been done
HashSet<DiagnosticInfo> useSiteDiagnostics = null;
......@@ -437,7 +437,7 @@ private static void Assert(bool condition, string message = null)
ArrayBuilder<BoundDagTest> tests,
ArrayBuilder<BoundPatternBinding> bindings)
{
Debug.Assert(input.Type.IsErrorType() || recursive.InputType.IsErrorType() || input.Type == recursive.InputType);
Debug.Assert(input.Type.IsErrorType() || recursive.InputType.IsErrorType() || input.Type.Equals(recursive.InputType, TypeCompareKind.AllIgnoreOptions));
var inputType = recursive.DeclaredType?.Type ?? input.Type.StrippedType();
input = MakeConvertToType(input, recursive.Syntax, inputType, tests);
......@@ -1259,7 +1259,7 @@ private static bool SameTest(BoundDagTest x, BoundDagTest y)
switch (x.Kind)
{
case BoundKind.DagTypeTest:
return ((BoundDagTypeTest)x).Type == ((BoundDagTypeTest)y).Type;
return ((BoundDagTypeTest)x).Type.Equals(((BoundDagTypeTest)y).Type, TypeCompareKind.AllIgnoreOptions);
case BoundKind.DagValueTest:
return ((BoundDagValueTest)x).Value == ((BoundDagValueTest)y).Value;
......
......@@ -123,7 +123,7 @@ private TypeSymbol InferResultType(ImmutableArray<BoundSwitchExpressionArm> swit
foreach (var @case in switchCases)
{
var type = @case.Value.Type;
if (type != null && seenTypes.Add(type))
if (!(type is null) && seenTypes.Add(type))
{
typesInOrder.Add(type);
}
......@@ -132,7 +132,7 @@ private TypeSymbol InferResultType(ImmutableArray<BoundSwitchExpressionArm> swit
HashSet<DiagnosticInfo> useSiteDiagnostics = null;
var commonType = BestTypeInferrer.GetBestType(typesInOrder, Conversions, out _, ref useSiteDiagnostics);
diagnostics.Add(SwitchExpressionSyntax, useSiteDiagnostics);
if (commonType == null)
if (commonType is null)
{
diagnostics.Add(ErrorCode.ERR_SwitchExpressionNoBestType, SwitchExpressionSyntax.Location);
commonType = CreateErrorType();
......
......@@ -17,7 +17,7 @@ partial class BoundDagTemp
public override bool Equals(object obj) => obj is BoundDagTemp other && this.Equals(other);
public bool Equals(BoundDagTemp other)
{
return other != (object)null && this.Type == other.Type && object.Equals(this.Source, other.Source) && this.Index == other.Index;
return other != (object)null && this.Type.Equals(other.Type, TypeCompareKind.AllIgnoreOptions) && object.Equals(this.Source, other.Source) && this.Index == other.Index;
}
public override int GetHashCode()
{
......
......@@ -292,7 +292,7 @@ void appendSourceCore(BoundNode node, int indent, Dictionary<SynthesizedLocal, i
}
case BoundSwitchLabel label:
{
appendSource(label.ExpressionOpt);
appendSource(label.Pattern);
break;
}
case BoundUnaryOperator unary:
......
......@@ -862,15 +862,6 @@ protected void RestorePending(SavedPending oldPending)
}
}
break;
case BoundKind.PatternSwitchSection:
{
var sec = (BoundPatternSwitchSection)node;
foreach (var label in sec.SwitchLabels)
{
stateChangedAfterUse |= ResolveBranches(label.Label, sec);
}
}
break;
default:
// there are no other kinds of labels
throw ExceptionUtilities.UnexpectedValue(node.Kind);
......
......@@ -52,12 +52,12 @@ internal partial class AsyncRewriter : StateMachineRewriter
method.IsIAsyncEnumeratorReturningAsync(compilation);
if (isAsyncEnumerableOrEnumerator && !method.IsIterator)
{
bool containsAwait = AwaitDetector.ContainsAwait(body);
bool containsAwait = AwaitDetector.ContainsAwait(bodyWithAwaitLifted);
diagnostics.Add(containsAwait ? ErrorCode.ERR_PossibleAsyncIteratorWithoutYield : ErrorCode.ERR_PossibleAsyncIteratorWithoutYieldOrAwait,
method.Locations[0], method.ReturnType);
stateMachineType = null;
return body;
return bodyWithAwaitLifted;
}
// The CLR doesn't support adding fields to structs, so in order to enable EnC in an async method we need to generate a class.
......
......@@ -216,7 +216,7 @@ void addArg(RefKind refKind, BoundExpression expression)
{
// This is an evaluation of an indexed property with a constant int value.
// The input type must be ITuple, and the property must be a property of ITuple.
Debug.Assert(e.Property.ContainingSymbol == input.Type);
Debug.Assert(e.Property.ContainingSymbol.Equals(input.Type));
Debug.Assert(e.Property.GetMethod.ParameterCount == 1);
Debug.Assert(e.Property.GetMethod.Parameters[0].Type.SpecialType == SpecialType.System_Int32);
TypeSymbol type = e.Property.GetMethod.ReturnType.TypeSymbol;
......@@ -260,7 +260,7 @@ protected BoundExpression LowerTest(BoundDagTest test)
private BoundExpression MakeEqual(BoundExpression loweredLiteral, BoundExpression input)
{
Debug.Assert(loweredLiteral.Type == input.Type);
Debug.Assert(loweredLiteral.Type.Equals(input.Type, TypeCompareKind.AllIgnoreOptions));
if (loweredLiteral.Type.SpecialType == SpecialType.System_Double && double.IsNaN(loweredLiteral.ConstantValue.DoubleValue))
{
......@@ -340,7 +340,7 @@ private BoundExpression MakeEqual(BoundExpression loweredLiteral, BoundExpressio
if (test is BoundDagTypeTest typeDecision &&
evaluation is BoundDagTypeEvaluation typeEvaluation &&
typeDecision.Type.IsReferenceType &&
typeEvaluation.Type == typeDecision.Type &&
typeEvaluation.Type.Equals(typeDecision.Type, TypeCompareKind.AllIgnoreOptions) &&
typeEvaluation.Input == typeDecision.Input
)
{
......
......@@ -47,7 +47,7 @@ private CSharpSyntaxNode ParseTypeOrPatternForIsOperatorCore()
switch (tk)
{
case SyntaxKind.IdentifierToken when this.CurrentToken.ContextualKind == SyntaxKind.UnderscoreToken:
// We permit a type named `_` on the right-hand-side of an is operator, but not inside of a pattern.
// We permit a type named `_` on the right-hand-side of an is operator, but not inside of a pattern.
case SyntaxKind.CloseParenToken:
case SyntaxKind.CloseBracketToken:
case SyntaxKind.CloseBraceToken:
......@@ -557,7 +557,7 @@ private PropertyPatternClauseSyntax ParsePropertyPatternClause()
var list = _pool.AllocateSeparated<SubpatternSyntax>();
try
{
tryAgain:
tryAgain:
if (this.IsPossibleSubpatternElement() || this.CurrentToken.Kind == SyntaxKind.CommaToken)
{
......
......@@ -21,12 +21,8 @@
Do not install this package manually, it will be added as a prerequisite by other packages that require it.
</PackageDescription>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<LangVersion>7.2</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<LangVersion>7.2</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
<ItemGroup>
<Content Include="$(NuGetPackageRoot)\microsoft.diasymreader.native\$(MicrosoftDiaSymReaderNativeVersion)\runtimes\win\native\Microsoft.DiaSymReader.Native.x86.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
......
......@@ -519,7 +519,7 @@ End Namespace
WellKnownType.System_Threading_Tasks_ValueTask_T,
WellKnownType.System_Threading_Tasks_ValueTask,
WellKnownType.System_Runtime_CompilerServices_AsyncIteratorMethodBuilder,
WellKnownType.System_Threading_CancellationToken
WellKnownType.System_Threading_CancellationToken,
WellKnownType.System_MatchFailureException,
WellKnownType.System_Runtime_CompilerServices_NonNullTypesAttribute,
WellKnownType.Microsoft_CodeAnalysis_EmbeddedAttribute
......@@ -580,7 +580,7 @@ End Namespace
WellKnownType.System_Threading_Tasks_ValueTask_T,
WellKnownType.System_Threading_Tasks_ValueTask,
WellKnownType.System_Runtime_CompilerServices_AsyncIteratorMethodBuilder,
WellKnownType.System_Threading_CancellationToken
WellKnownType.System_Threading_CancellationToken,
WellKnownType.System_MatchFailureException,
WellKnownType.System_Runtime_CompilerServices_NonNullTypesAttribute,
WellKnownType.Microsoft_CodeAnalysis_EmbeddedAttribute
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册