From 42415c00c3c4332549c3ef3c73e24c04927d88dc Mon Sep 17 00:00:00 2001 From: Neal Gafter Date: Thu, 20 Dec 2018 10:50:11 -0800 Subject: [PATCH] Fix up merge --- src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs | 4 ++-- src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs | 4 ++-- .../CSharp/Portable/Binder/DecisionDagBuilder.cs | 8 ++++---- .../CSharp/Portable/Binder/SwitchExpressionBinder.cs | 4 ++-- src/Compilers/CSharp/Portable/BoundTree/BoundDagTemp.cs | 2 +- .../CSharp/Portable/BoundTree/BoundNode_Source.cs | 2 +- .../CSharp/Portable/FlowAnalysis/AbstractFlowPass.cs | 9 --------- .../Portable/Lowering/AsyncRewriter/AsyncRewriter.cs | 4 ++-- .../Lowering/LocalRewriter/LocalRewriter_Patterns.cs | 6 +++--- .../CSharp/Portable/Parser/LanguageParser_Patterns.cs | 4 ++-- .../Core/Portable/Microsoft.CodeAnalysis.csproj | 8 ++------ .../Symbol/SymbolsTests/WellKnownTypeValidationTests.vb | 4 ++-- 12 files changed, 23 insertions(+), 36 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs index 4b2624422e2..4efe08f0e0a 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs @@ -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 diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs index 97f4ec636c1..ca58df424ba 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs @@ -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. diff --git a/src/Compilers/CSharp/Portable/Binder/DecisionDagBuilder.cs b/src/Compilers/CSharp/Portable/Binder/DecisionDagBuilder.cs index 9f79009640c..ef28dd6db57 100644 --- a/src/Compilers/CSharp/Portable/Binder/DecisionDagBuilder.cs +++ b/src/Compilers/CSharp/Portable/Binder/DecisionDagBuilder.cs @@ -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 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 useSiteDiagnostics = null; @@ -437,7 +437,7 @@ private static void Assert(bool condition, string message = null) ArrayBuilder tests, ArrayBuilder 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; diff --git a/src/Compilers/CSharp/Portable/Binder/SwitchExpressionBinder.cs b/src/Compilers/CSharp/Portable/Binder/SwitchExpressionBinder.cs index 057a4d720b0..f27f706881d 100644 --- a/src/Compilers/CSharp/Portable/Binder/SwitchExpressionBinder.cs +++ b/src/Compilers/CSharp/Portable/Binder/SwitchExpressionBinder.cs @@ -123,7 +123,7 @@ private TypeSymbol InferResultType(ImmutableArray 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 swit HashSet 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(); diff --git a/src/Compilers/CSharp/Portable/BoundTree/BoundDagTemp.cs b/src/Compilers/CSharp/Portable/BoundTree/BoundDagTemp.cs index 56695b04e2d..a006c4c014e 100644 --- a/src/Compilers/CSharp/Portable/BoundTree/BoundDagTemp.cs +++ b/src/Compilers/CSharp/Portable/BoundTree/BoundDagTemp.cs @@ -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() { diff --git a/src/Compilers/CSharp/Portable/BoundTree/BoundNode_Source.cs b/src/Compilers/CSharp/Portable/BoundTree/BoundNode_Source.cs index a7d121be481..dfd217677e5 100644 --- a/src/Compilers/CSharp/Portable/BoundTree/BoundNode_Source.cs +++ b/src/Compilers/CSharp/Portable/BoundTree/BoundNode_Source.cs @@ -292,7 +292,7 @@ void appendSourceCore(BoundNode node, int indent, Dictionary(); try { - tryAgain: +tryAgain: if (this.IsPossibleSubpatternElement() || this.CurrentToken.Kind == SyntaxKind.CommaToken) { diff --git a/src/Compilers/Core/Portable/Microsoft.CodeAnalysis.csproj b/src/Compilers/Core/Portable/Microsoft.CodeAnalysis.csproj index 2b3f49a695d..4438a5ea232 100644 --- a/src/Compilers/Core/Portable/Microsoft.CodeAnalysis.csproj +++ b/src/Compilers/Core/Portable/Microsoft.CodeAnalysis.csproj @@ -21,12 +21,8 @@ Do not install this package manually, it will be added as a prerequisite by other packages that require it. - - 7.2 - - - 7.2 - + + PreserveNewest diff --git a/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/WellKnownTypeValidationTests.vb b/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/WellKnownTypeValidationTests.vb index 105f91c8e96..4df04b96581 100644 --- a/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/WellKnownTypeValidationTests.vb +++ b/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/WellKnownTypeValidationTests.vb @@ -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 -- GitLab