diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs index 4b2624422e274a9cfe38353921883b194e119c5b..4efe08f0e0a6983ee4c71f205f0ff2bbcf5fbe8c 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 97f4ec636c1819badf01c11dae7ceb8ea6a7750e..ca58df424ba382fbe3b17f96e843cac8fe7c1721 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 9f79009640ccf031029a561c00b378611b47e4e8..ef28dd6db577e834f21891d38b2d57f6b11209f6 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 057a4d720b0c795106dabfe9a9c4282e1b7932fc..f27f706881dc82ee0804b19460671b5bcda52c50 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 56695b04e2d3af8abaca83709d2e986b12965ef1..a006c4c014e4948748681cabf3cdbfa0124a6ecb 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 a7d121be481ce0a026ca978bafa5216577256d20..dfd217677e548a4dfa1df0165cc84042242f6c80 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 2b3f49a695dcfea53a356130e3057b7effa4af09..4438a5ea232bbdc1134dc9242e474c951fb5ac46 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 105f91c8e9681af6931c24dda179fd8b7d0affea..4df04b96581aa9e6ca5e03eedf011b842c4beb36 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