Upgrade roslyn deps to 3.4.0 (dotnet/aspnetcore-tooling#1564)

\n\nCommit migrated from 6cd4f21348
This commit is contained in:
Ajay Bhargav B 2020-02-10 12:56:51 -08:00 committed by GitHub
parent 718a130b3f
commit 2be31713ce
10 changed files with 48 additions and 48 deletions

View File

@ -110,11 +110,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
if (string.Equals(selectedMethod.Name, ViewComponentTypes.AsyncMethodName, StringComparison.Ordinal))
{
// Will invoke asynchronously. Method must not return Task or Task<T>.
if (Equals(returnType, _taskSymbol))
if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol))
{
// This is ok.
}
else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol))
else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol))
{
// This is ok.
}
@ -134,13 +134,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
method = null;
return false;
}
else if (Equals(returnType, _taskSymbol))
else if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol))
{
diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat));
method = null;
return false;
}
else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol))
else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol))
{
diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat));
method = null;
@ -208,13 +208,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
private string GetIndexerValueTypeName(IParameterSymbol parameter)
{
INamedTypeSymbol dictionaryType;
if (Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol))
if (SymbolEqualityComparer.Default.Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol))
{
dictionaryType = (INamedTypeSymbol)parameter.Type;
}
else if (parameter.Type.AllInterfaces.Any(s => Equals(s.ConstructedFrom, _iDictionarySymbol)))
else if (parameter.Type.AllInterfaces.Any(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol)))
{
dictionaryType = parameter.Type.AllInterfaces.First(s => Equals(s.ConstructedFrom, _iDictionarySymbol));
dictionaryType = parameter.Type.AllInterfaces.First(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol));
}
else
{
@ -234,7 +234,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
private string GetShortName(INamedTypeSymbol componentType)
{
var viewComponentAttribute = componentType.GetAttributes().Where(a => Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault();
var viewComponentAttribute = componentType.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault();
var name = viewComponentAttribute
?.NamedArguments
.Where(namedArgument => string.Equals(namedArgument.Key, ViewComponentTypes.ViewComponent.Name, StringComparison.Ordinal))

View File

@ -73,7 +73,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
return false;
}
var attribute = type.GetAttributes().Where(a => Equals(a.AttributeClass, queryAttribute)).FirstOrDefault();
var attribute = type.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, queryAttribute)).FirstOrDefault();
if (attribute != null)
{

View File

@ -104,11 +104,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
if (string.Equals(selectedMethod.Name, ViewComponentTypes.AsyncMethodName, StringComparison.Ordinal))
{
// Will invoke asynchronously. Method must not return Task or Task<T>.
if (Equals(returnType, _taskSymbol))
if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol))
{
// This is ok.
}
else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol))
else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol))
{
// This is ok.
}
@ -128,13 +128,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
method = null;
return false;
}
else if (Equals(returnType, _taskSymbol))
else if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol))
{
diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat));
method = null;
return false;
}
else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol))
else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol))
{
diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat));
method = null;
@ -223,13 +223,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
private string GetIndexerValueTypeName(IParameterSymbol parameter)
{
INamedTypeSymbol dictionaryType;
if (Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol))
if (SymbolEqualityComparer.Default.Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol))
{
dictionaryType = (INamedTypeSymbol)parameter.Type;
}
else if (parameter.Type.AllInterfaces.Any(s => Equals(s.ConstructedFrom, _iDictionarySymbol)))
else if (parameter.Type.AllInterfaces.Any(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol)))
{
dictionaryType = parameter.Type.AllInterfaces.First(s => Equals(s.ConstructedFrom, _iDictionarySymbol));
dictionaryType = parameter.Type.AllInterfaces.First(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol));
}
else
{
@ -249,7 +249,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
private string GetShortName(INamedTypeSymbol componentType)
{
var viewComponentAttribute = componentType.GetAttributes().Where(a => Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault();
var viewComponentAttribute = componentType.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault();
var name = viewComponentAttribute
?.NamedArguments
.Where(namedArgument => string.Equals(namedArgument.Key, ViewComponentTypes.ViewComponent.Name, StringComparison.Ordinal))

View File

@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
return false;
}
var attribute = type.GetAttributes().Where(a => Equals(a.AttributeClass, queryAttribute)).FirstOrDefault();
var attribute = type.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, queryAttribute)).FirstOrDefault();
if (attribute != null)
{

View File

@ -104,11 +104,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
if (string.Equals(selectedMethod.Name, ViewComponentTypes.AsyncMethodName, StringComparison.Ordinal))
{
// Will invoke asynchronously. Method must not return Task or Task<T>.
if (Equals(returnType, _taskSymbol))
if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol))
{
// This is ok.
}
else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol))
else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol))
{
// This is ok.
}
@ -128,13 +128,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
method = null;
return false;
}
else if (Equals(returnType, _taskSymbol))
else if (SymbolEqualityComparer.Default.Equals(returnType, _taskSymbol))
{
diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat));
method = null;
return false;
}
else if (returnType.IsGenericType && Equals(returnType.ConstructedFrom, _genericTaskSymbol))
else if (returnType.IsGenericType && SymbolEqualityComparer.Default.Equals(returnType.ConstructedFrom, _genericTaskSymbol))
{
diagnostic = RazorExtensionsDiagnosticFactory.CreateViewComponent_SyncMethod_CannotReturnTask(type.ToDisplayString(FullNameTypeDisplayFormat));
method = null;
@ -223,13 +223,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
private string GetIndexerValueTypeName(IParameterSymbol parameter)
{
INamedTypeSymbol dictionaryType;
if (Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol))
if (SymbolEqualityComparer.Default.Equals((parameter.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol))
{
dictionaryType = (INamedTypeSymbol)parameter.Type;
}
else if (parameter.Type.AllInterfaces.Any(s => Equals(s.ConstructedFrom, _iDictionarySymbol)))
else if (parameter.Type.AllInterfaces.Any(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol)))
{
dictionaryType = parameter.Type.AllInterfaces.First(s => Equals(s.ConstructedFrom, _iDictionarySymbol));
dictionaryType = parameter.Type.AllInterfaces.First(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol));
}
else
{
@ -249,7 +249,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
private string GetShortName(INamedTypeSymbol componentType)
{
var viewComponentAttribute = componentType.GetAttributes().Where(a => Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault();
var viewComponentAttribute = componentType.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _viewComponentAttributeSymbol)).FirstOrDefault();
var name = viewComponentAttribute
?.NamedArguments
.Where(namedArgument => string.Equals(namedArgument.Key, ViewComponentTypes.ViewComponent.Name, StringComparison.Ordinal))

View File

@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
return false;
}
var attribute = type.GetAttributes().Where(a => Equals(a.AttributeClass, queryAttribute)).FirstOrDefault();
var attribute = type.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, queryAttribute)).FirstOrDefault();
if (attribute != null)
{

View File

@ -235,7 +235,7 @@ namespace Microsoft.CodeAnalysis.Razor
// We need to check the constructor argument length here, because this can show up as 0
// if the language service fails to initialize. This is an invalid case, so skip it.
if (Equals(attribute.AttributeClass, bindElement) && attribute.ConstructorArguments.Length == 4)
if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, bindElement) && attribute.ConstructorArguments.Length == 4)
{
results.Add(new ElementBindData(
type.ContainingAssembly.Name,
@ -246,7 +246,7 @@ namespace Microsoft.CodeAnalysis.Razor
(string)attribute.ConstructorArguments[2].Value,
(string)attribute.ConstructorArguments[3].Value));
}
else if (Equals(attribute.AttributeClass, bindInputElement) && attribute.ConstructorArguments.Length == 4)
else if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, bindInputElement) && attribute.ConstructorArguments.Length == 4)
{
results.Add(new ElementBindData(
type.ContainingAssembly.Name,
@ -257,7 +257,7 @@ namespace Microsoft.CodeAnalysis.Razor
(string)attribute.ConstructorArguments[2].Value,
(string)attribute.ConstructorArguments[3].Value));
}
else if (Equals(attribute.AttributeClass, bindInputElement) && attribute.ConstructorArguments.Length == 6)
else if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, bindInputElement) && attribute.ConstructorArguments.Length == 6)
{
results.Add(new ElementBindData(
type.ContainingAssembly.Name,

View File

@ -328,7 +328,7 @@ namespace Microsoft.CodeAnalysis.Razor
var properties = new Dictionary<string, (IPropertySymbol, PropertyKind)>(StringComparer.Ordinal);
do
{
if (Equals(type, symbols.ComponentBase))
if (SymbolEqualityComparer.Default.Equals(type, symbols.ComponentBase))
{
// The ComponentBase base class doesn't have any [Parameter].
// Bail out now to avoid walking through its many members, plus the members
@ -381,7 +381,7 @@ namespace Microsoft.CodeAnalysis.Razor
kind = PropertyKind.Ignored;
}
if (!property.GetAttributes().Any(a => Equals(a.AttributeClass, symbols.ParameterAttribute)))
if (!property.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, symbols.ParameterAttribute)))
{
if (property.IsOverride)
{
@ -399,7 +399,7 @@ namespace Microsoft.CodeAnalysis.Razor
kind = PropertyKind.Enum;
}
if (kind == PropertyKind.Default && Equals(property.Type, symbols.RenderFragment))
if (kind == PropertyKind.Default && SymbolEqualityComparer.Default.Equals(property.Type, symbols.RenderFragment))
{
kind = PropertyKind.ChildContent;
}
@ -407,12 +407,12 @@ namespace Microsoft.CodeAnalysis.Razor
if (kind == PropertyKind.Default &&
property.Type is INamedTypeSymbol namedType &&
namedType.IsGenericType &&
Equals(namedType.ConstructedFrom, symbols.RenderFragmentOfT))
SymbolEqualityComparer.Default.Equals(namedType.ConstructedFrom, symbols.RenderFragmentOfT))
{
kind = PropertyKind.ChildContent;
}
if (kind == PropertyKind.Default && Equals(property.Type, symbols.EventCallback))
if (kind == PropertyKind.Default && SymbolEqualityComparer.Default.Equals(property.Type, symbols.EventCallback))
{
kind = PropertyKind.EventCallback;
}
@ -420,7 +420,7 @@ namespace Microsoft.CodeAnalysis.Razor
if (kind == PropertyKind.Default &&
property.Type is INamedTypeSymbol namedType2 &&
namedType2.IsGenericType &&
Equals(namedType2.ConstructedFrom, symbols.EventCallbackOfT))
SymbolEqualityComparer.Default.Equals(namedType2.ConstructedFrom, symbols.EventCallbackOfT))
{
kind = PropertyKind.EventCallback;
}

View File

@ -80,7 +80,7 @@ namespace Microsoft.CodeAnalysis.Razor
{
var targetElementAttributes = type
.GetAttributes()
.Where(attribute => Equals(attribute.AttributeClass, _htmlTargetElementAttributeSymbol));
.Where(attribute => SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, _htmlTargetElementAttributeSymbol));
// If there isn't an attribute specifying the tag name derive it from the name
if (!targetElementAttributes.Any())
@ -139,7 +139,7 @@ namespace Microsoft.CodeAnalysis.Razor
private void AddAllowedChildren(INamedTypeSymbol type, TagHelperDescriptorBuilder builder)
{
var restrictChildrenAttribute = type.GetAttributes().Where(a => Equals(a.AttributeClass, _restrictChildrenAttributeSymbol)).FirstOrDefault();
var restrictChildrenAttribute = type.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _restrictChildrenAttributeSymbol)).FirstOrDefault();
if (restrictChildrenAttribute == null)
{
return;
@ -174,7 +174,7 @@ namespace Microsoft.CodeAnalysis.Razor
private void AddTagOutputHint(INamedTypeSymbol type, TagHelperDescriptorBuilder builder)
{
string outputElementHint = null;
var outputElementHintAttribute = type.GetAttributes().Where(a => Equals(a.AttributeClass, _outputElementHintAttributeSymbol)).FirstOrDefault();
var outputElementHintAttribute = type.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _outputElementHintAttributeSymbol)).FirstOrDefault();
if (outputElementHintAttribute != null)
{
outputElementHint = (string)(outputElementHintAttribute.ConstructorArguments[0]).Value;
@ -189,7 +189,7 @@ namespace Microsoft.CodeAnalysis.Razor
{
var attributeNameAttribute = property
.GetAttributes()
.Where(a => Equals(a.AttributeClass, _htmlAttributeNameAttributeSymbol))
.Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _htmlAttributeNameAttributeSymbol))
.FirstOrDefault();
bool hasExplicitName;
@ -310,13 +310,13 @@ namespace Microsoft.CodeAnalysis.Razor
private IReadOnlyList<ITypeSymbol> GetDictionaryArgumentTypes(IPropertySymbol property)
{
INamedTypeSymbol dictionaryType;
if (Equals((property.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol))
if (SymbolEqualityComparer.Default.Equals((property.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol))
{
dictionaryType = (INamedTypeSymbol)property.Type;
}
else if (property.Type.AllInterfaces.Any(s => Equals(s.ConstructedFrom, _iDictionarySymbol)))
else if (property.Type.AllInterfaces.Any(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol)))
{
dictionaryType = property.Type.AllInterfaces.First(s => Equals(s.ConstructedFrom, _iDictionarySymbol));
dictionaryType = property.Type.AllInterfaces.First(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol));
}
else
{
@ -380,7 +380,7 @@ namespace Microsoft.CodeAnalysis.Razor
private bool IsPotentialDictionaryProperty(IPropertySymbol property)
{
return
(Equals((property.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol) || property.Type.AllInterfaces.Any(s => Equals(s.ConstructedFrom, _iDictionarySymbol))) &&
(SymbolEqualityComparer.Default.Equals((property.Type as INamedTypeSymbol)?.ConstructedFrom, _iDictionarySymbol) || property.Type.AllInterfaces.Any(s => SymbolEqualityComparer.Default.Equals(s.ConstructedFrom, _iDictionarySymbol))) &&
GetDictionaryArgumentTypes(property)?[0].SpecialType == SpecialType.System_String;
}
@ -397,8 +397,8 @@ namespace Microsoft.CodeAnalysis.Razor
property.Parameters.Length == 0 &&
property.GetMethod != null &&
property.GetMethod.DeclaredAccessibility == Accessibility.Public &&
property.GetAttributes().Where(a => Equals(a.AttributeClass, _htmlAttributeNotBoundAttributeSymbol)).FirstOrDefault() == null &&
(property.GetAttributes().Any(a => Equals(a.AttributeClass, _htmlAttributeNameAttributeSymbol)) ||
property.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _htmlAttributeNotBoundAttributeSymbol)).FirstOrDefault() == null &&
(property.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _htmlAttributeNameAttributeSymbol)) ||
property.SetMethod != null && property.SetMethod.DeclaredAccessibility == Accessibility.Public ||
IsPotentialDictionaryProperty(property)) &&
!accessibleProperties.ContainsKey(property.Name))
@ -418,7 +418,7 @@ namespace Microsoft.CodeAnalysis.Razor
{
if (ExcludeHidden)
{
var editorBrowsableAttribute = symbol.GetAttributes().Where(a => Equals(a.AttributeClass, _editorBrowsableAttributeSymbol)).FirstOrDefault();
var editorBrowsableAttribute = symbol.GetAttributes().Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, _editorBrowsableAttributeSymbol)).FirstOrDefault();
if (editorBrowsableAttribute == null)
{

View File

@ -81,7 +81,7 @@ namespace Microsoft.CodeAnalysis.Razor
{
var attribute = attributes[j];
if (Equals(attribute.AttributeClass, eventHandlerAttribute))
if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, eventHandlerAttribute))
{
var enablePreventDefault = false;
var enableStopPropagation = false;