未验证 提交 b27cb191 编写于 作者: F Fred Silberberg 提交者: GitHub

Rename TypeArgumentsNullableAnnotations to TypeArgumentNullabl… (#37158)

Rename TypeArgumentsNullableAnnotations to TypeArgumentNullableAnnotations
......@@ -1048,7 +1048,7 @@ ImmutableArray<ITypeSymbol> IMethodSymbol.TypeArguments
}
}
ImmutableArray<CodeAnalysis.NullableAnnotation> IMethodSymbol.TypeArgumentsNullableAnnotations => TypeArgumentsWithAnnotations.SelectAsArray(arg => arg.NullableAnnotation.ToPublicAnnotation());
ImmutableArray<CodeAnalysis.NullableAnnotation> IMethodSymbol.TypeArgumentNullableAnnotations => TypeArgumentsWithAnnotations.SelectAsArray(arg => arg.NullableAnnotation.ToPublicAnnotation());
ImmutableArray<ITypeParameterSymbol> IMethodSymbol.TypeParameters
{
......
......@@ -1583,7 +1583,7 @@ ImmutableArray<ITypeSymbol> INamedTypeSymbol.TypeArguments
}
}
ImmutableArray<CodeAnalysis.NullableAnnotation> INamedTypeSymbol.TypeArgumentsNullableAnnotations
ImmutableArray<CodeAnalysis.NullableAnnotation> INamedTypeSymbol.TypeArgumentNullableAnnotations
{
get => this.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.SelectAsArray(a => a.NullableAnnotation.ToPublicAnnotation());
}
......
......@@ -5174,7 +5174,7 @@ public ImmutableArray<ITypeSymbol> TypeArguments
}
}
public ImmutableArray<CodeAnalysis.NullableAnnotation> TypeArgumentsNullableAnnotations
public ImmutableArray<CodeAnalysis.NullableAnnotation> TypeArgumentNullableAnnotations
{
get
{
......
......@@ -82,9 +82,9 @@ void M1(C? c)
var invocations = root.DescendantNodes().OfType<InvocationExpressionSyntax>().ToList();
var expressionTypes = invocations.Select(inv => model.GetTypeInfo(inv).Type).Cast<INamedTypeSymbol>().ToList();
Assert.Equal(PublicNullableAnnotation.NotAnnotated, expressionTypes[0].TypeArgumentsNullableAnnotations.Single());
Assert.Equal(PublicNullableAnnotation.Annotated, expressionTypes[1].TypeArgumentsNullableAnnotations.Single());
Assert.Equal(PublicNullableAnnotation.NotAnnotated, expressionTypes[2].TypeArgumentsNullableAnnotations.Single());
Assert.Equal(PublicNullableAnnotation.NotAnnotated, expressionTypes[0].TypeArgumentNullableAnnotations.Single());
Assert.Equal(PublicNullableAnnotation.Annotated, expressionTypes[1].TypeArgumentNullableAnnotations.Single());
Assert.Equal(PublicNullableAnnotation.NotAnnotated, expressionTypes[2].TypeArgumentNullableAnnotations.Single());
}
[Fact(Skip = "https://github.com/dotnet/roslyn/issues/34412")]
......@@ -1153,7 +1153,7 @@ void M(string? s)
static void verifySymbolInfo(IMethodSymbol methodSymbol, PublicNullableAnnotation expectedAnnotation)
{
Assert.Equal(expectedAnnotation, methodSymbol.TypeArgumentsNullableAnnotations.Single());
Assert.Equal(expectedAnnotation, methodSymbol.TypeArgumentNullableAnnotations.Single());
Assert.Equal(expectedAnnotation, methodSymbol.Parameters.Single().NullableAnnotation);
Assert.Equal(expectedAnnotation, methodSymbol.ReturnNullableAnnotation);
}
......@@ -1193,9 +1193,9 @@ void M(string? s)
static void verifySymbolInfo(IMethodSymbol methodSymbol, PublicNullableAnnotation expectedAnnotation)
{
Assert.Equal(expectedAnnotation, methodSymbol.TypeArgumentsNullableAnnotations.Single());
Assert.Equal(expectedAnnotation, methodSymbol.TypeArgumentNullableAnnotations.Single());
Assert.Equal(expectedAnnotation, methodSymbol.Parameters.Single().NullableAnnotation);
Assert.Equal(expectedAnnotation, ((INamedTypeSymbol)methodSymbol.ReturnType).TypeArgumentsNullableAnnotations.Single());
Assert.Equal(expectedAnnotation, ((INamedTypeSymbol)methodSymbol.ReturnType).TypeArgumentNullableAnnotations.Single());
}
}
}
......
......@@ -36,8 +36,8 @@ Microsoft.CodeAnalysis.IFieldSymbol.NullableAnnotation.get -> Microsoft.CodeAnal
Microsoft.CodeAnalysis.ILocalSymbol.NullableAnnotation.get -> Microsoft.CodeAnalysis.NullableAnnotation
Microsoft.CodeAnalysis.IMethodSymbol.ReceiverNullableAnnotation.get -> Microsoft.CodeAnalysis.NullableAnnotation
Microsoft.CodeAnalysis.IMethodSymbol.ReturnNullableAnnotation.get -> Microsoft.CodeAnalysis.NullableAnnotation
Microsoft.CodeAnalysis.IMethodSymbol.TypeArgumentsNullableAnnotations.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.NullableAnnotation>
Microsoft.CodeAnalysis.INamedTypeSymbol.TypeArgumentsNullableAnnotations.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.NullableAnnotation>
Microsoft.CodeAnalysis.IMethodSymbol.TypeArgumentNullableAnnotations.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.NullableAnnotation>
Microsoft.CodeAnalysis.INamedTypeSymbol.TypeArgumentNullableAnnotations.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.NullableAnnotation>
Microsoft.CodeAnalysis.IParameterSymbol.NullableAnnotation.get -> Microsoft.CodeAnalysis.NullableAnnotation
Microsoft.CodeAnalysis.IPropertySymbol.NullableAnnotation.get -> Microsoft.CodeAnalysis.NullableAnnotation
Microsoft.CodeAnalysis.ITypeParameterSymbol.ConstraintNullableAnnotations.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.NullableAnnotation>
......
......@@ -107,7 +107,7 @@ public interface IMethodSymbol : ISymbol
/// for the type parameters. If nothing has been substituted for a given type parameter,
/// then <see cref="NullableAnnotation.NotApplicable"/> is returned.
/// </summary>
ImmutableArray<NullableAnnotation> TypeArgumentsNullableAnnotations { get; }
ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations { get; }
/// <summary>
/// Get the type parameters on this method. If the method has not generic,
......
......@@ -77,7 +77,7 @@ public interface INamedTypeSymbol : ITypeSymbol
/// for the type parameters. If nothing has been substituted for a given type parameter,
/// then <see cref="NullableAnnotation.NotApplicable"/> is returned for that type argument.
/// </summary>
ImmutableArray<NullableAnnotation> TypeArgumentsNullableAnnotations { get; }
ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations { get; }
/// <summary>
/// Returns custom modifiers for the type argument that has been substituted for the type parameter.
......
......@@ -1007,7 +1007,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
End Get
End Property
Private ReadOnly Property IMethodSymbol_TypeArgumentsNullableAnnotation As ImmutableArray(Of NullableAnnotation) Implements IMethodSymbol.TypeArgumentsNullableAnnotations
Private ReadOnly Property IMethodSymbol_TypeArgumentsNullableAnnotation As ImmutableArray(Of NullableAnnotation) Implements IMethodSymbol.TypeArgumentNullableAnnotations
Get
Return Me.TypeArguments.SelectAsArray(Function(t) NullableAnnotation.NotApplicable)
End Get
......
......@@ -1144,7 +1144,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
End Get
End Property
Private ReadOnly Property INamedTypeSymbol_TypeArgumentsNullableAnnotations As ImmutableArray(Of NullableAnnotation) Implements INamedTypeSymbol.TypeArgumentsNullableAnnotations
Private ReadOnly Property TypeArgumentNullableAnnotations As ImmutableArray(Of NullableAnnotation) Implements INamedTypeSymbol.TypeArgumentNullableAnnotations
Get
Return Me.TypeArgumentsNoUseSiteDiagnostics.SelectAsArray(Function(t) NullableAnnotation.NotApplicable)
End Get
......
......@@ -100,7 +100,7 @@ public ImmutableArray<AttributeData> GetReturnTypeAttributes()
public ImmutableArray<ITypeSymbol> TypeArguments => _symbol.TypeArguments;
public ImmutableArray<NullableAnnotation> TypeArgumentsNullableAnnotations => _symbol.TypeArgumentsNullableAnnotations;
public ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations => _symbol.TypeArgumentNullableAnnotations;
public ImmutableArray<ITypeParameterSymbol> TypeParameters => _symbol.TypeParameters;
......
......@@ -86,7 +86,7 @@ private static ISymbol WrapMember(ISymbol m, bool canImplementImplicitly, IDocum
public ImmutableArray<ITypeParameterSymbol> TypeParameters => _symbol.TypeParameters;
public ImmutableArray<ITypeSymbol> TypeArguments => _symbol.TypeArguments;
public ImmutableArray<NullableAnnotation> TypeArgumentsNullableAnnotations => _symbol.TypeArgumentsNullableAnnotations;
public ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations => _symbol.TypeArgumentNullableAnnotations;
public ImmutableArray<IMethodSymbol> InstanceConstructors => _symbol.InstanceConstructors;
public ImmutableArray<IMethodSymbol> StaticConstructors => _symbol.StaticConstructors;
public ImmutableArray<IMethodSymbol> Constructors => _symbol.Constructors;
......
......@@ -123,7 +123,7 @@ public TypeSyntax CreateSimpleTypeSyntax(INamedTypeSymbol symbol)
var typeArguments = symbol.IsUnboundGenericType
? Enumerable.Repeat((TypeSyntax)SyntaxFactory.OmittedTypeArgument(), symbol.TypeArguments.Length)
: symbol.TypeArguments.ZipAsArray(symbol.TypeArgumentsNullableAnnotations, (t, n) => t.WithNullability(n).GenerateTypeSyntax());
: symbol.TypeArguments.ZipAsArray(symbol.TypeArgumentNullableAnnotations, (t, n) => t.WithNullability(n).GenerateTypeSyntax());
return SyntaxFactory.GenericName(
symbol.Name.ToIdentifierToken(),
......
......@@ -1902,7 +1902,7 @@ private IEnumerable<TypeInferenceInfo> InferTypeInYieldStatement(YieldStatementS
// We don't care what the type is, as long as it has 1 type argument. This will work for IEnumerable, IEnumerator,
// IAsyncEnumerable, IAsyncEnumerator and it's also good for error recovery in case there is a missing using.
return memberType is INamedTypeSymbol namedType && namedType.TypeArguments.Length == 1
? SpecializedCollections.SingletonEnumerable(new TypeInferenceInfo(namedType.TypeArguments[0].WithNullability(namedType.TypeArgumentsNullableAnnotations[0])))
? SpecializedCollections.SingletonEnumerable(new TypeInferenceInfo(namedType.TypeArguments[0].WithNullability(namedType.TypeArgumentNullableAnnotations[0])))
: SpecializedCollections.EmptyEnumerable<TypeInferenceInfo>();
}
......@@ -1916,7 +1916,7 @@ private ITypeSymbol UnwrapTaskLike(ITypeSymbol type, bool isAsync)
if (type.OriginalDefinition.Equals(this.Compilation.TaskOfTType()))
{
var namedTypeSymbol = (INamedTypeSymbol)type;
return namedTypeSymbol.TypeArguments[0].WithNullability(namedTypeSymbol.TypeArgumentsNullableAnnotations[0]);
return namedTypeSymbol.TypeArguments[0].WithNullability(namedTypeSymbol.TypeArgumentNullableAnnotations[0]);
}
if (type.OriginalDefinition.Equals(this.Compilation.TaskType()))
......@@ -2242,7 +2242,7 @@ private IEnumerable<TypeInferenceInfo> GetCollectionElementType(INamedTypeSymbol
var elementType = parameters.ElementAtOrDefault(0);
if (elementType != null)
{
return SpecializedCollections.SingletonCollection(new TypeInferenceInfo(elementType.WithNullability(type.TypeArgumentsNullableAnnotations[0])));
return SpecializedCollections.SingletonCollection(new TypeInferenceInfo(elementType.WithNullability(type.TypeArgumentNullableAnnotations[0])));
}
}
......
......@@ -50,7 +50,7 @@ public virtual ImmutableArray<AttributeData> GetReturnTypeAttributes()
public NullableAnnotation ReceiverNullableAnnotation => ReceiverType.GetNullability();
public NullableAnnotation ReturnNullableAnnotation => ReturnType.GetNullability();
public ImmutableArray<NullableAnnotation> TypeArgumentsNullableAnnotations => TypeArguments.SelectAsArray(a => a.GetNullability());
public ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations => TypeArguments.SelectAsArray(a => a.GetNullability());
public virtual ITypeSymbol ReceiverType
{
......
......@@ -70,7 +70,7 @@ public INamedTypeSymbol Construct(params ITypeSymbol[] typeArguments)
public abstract ImmutableArray<IMethodSymbol> StaticConstructors { get; }
public abstract ImmutableArray<IMethodSymbol> Constructors { get; }
public abstract ImmutableArray<ITypeSymbol> TypeArguments { get; }
public abstract ImmutableArray<NullableAnnotation> TypeArgumentsNullableAnnotations { get; }
public abstract ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations { get; }
public ImmutableArray<CustomModifier> GetTypeArgumentCustomModifiers(int ordinal)
{
......
......@@ -27,7 +27,7 @@ internal class CodeGenerationConstructedNamedTypeSymbol : CodeGenerationAbstract
public override ImmutableArray<ITypeSymbol> TypeArguments => _typeArguments;
// TODO: implement this once INamedTypeSymbol.Construct is fixed in https://github.com/dotnet/roslyn/issues/36046
public override ImmutableArray<NullableAnnotation> TypeArgumentsNullableAnnotations => _typeArguments.SelectAsArray(t => NullableAnnotation.NotAnnotated);
public override ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations => _typeArguments.SelectAsArray(t => NullableAnnotation.NotAnnotated);
public override int Arity => _constructedFrom.Arity;
......
......@@ -122,7 +122,7 @@ public override ImmutableArray<ITypeSymbol> TypeArguments
}
}
public override ImmutableArray<NullableAnnotation> TypeArgumentsNullableAnnotations
public override ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations
{
get
{
......
......@@ -80,7 +80,7 @@ public override ITypeSymbol VisitNamedType(INamedTypeSymbol symbol)
symbol = updatedContainingType.GetTypeMembers(symbol.Name, symbol.Arity).First(m => m.TypeKind == symbol.TypeKind);
}
var typeArgumentsWithNullability = symbol.TypeArguments.ZipAsArray(symbol.TypeArgumentsNullableAnnotations, (t, n) => t.WithNullability(n));
var typeArgumentsWithNullability = symbol.TypeArguments.ZipAsArray(symbol.TypeArgumentNullableAnnotations, (t, n) => t.WithNullability(n));
var substitutedArguments = typeArgumentsWithNullability.Select(t => t.Accept(this));
if (typeArgumentsWithNullability.SequenceEqual(substitutedArguments))
{
......
......@@ -36,7 +36,7 @@ public override TResult Accept<TResult>(SymbolVisitor<TResult> visitor)
public IEnumerable<string> MemberNames => WrappedSymbol.MemberNames;
public ImmutableArray<ITypeParameterSymbol> TypeParameters => WrappedSymbol.TypeParameters;
public ImmutableArray<ITypeSymbol> TypeArguments => WrappedSymbol.TypeArguments;
public ImmutableArray<NullableAnnotation> TypeArgumentsNullableAnnotations => WrappedSymbol.TypeArgumentsNullableAnnotations;
public ImmutableArray<NullableAnnotation> TypeArgumentNullableAnnotations => WrappedSymbol.TypeArgumentNullableAnnotations;
public IMethodSymbol DelegateInvokeMethod => WrappedSymbol.DelegateInvokeMethod;
public INamedTypeSymbol EnumUnderlyingType => WrappedSymbol.EnumUnderlyingType;
public INamedTypeSymbol ConstructedFrom => WrappedSymbol.ConstructedFrom;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册