Skip to content

Commit

Permalink
Renamed "GenericArgCount" to "Arity".
Browse files Browse the repository at this point in the history
  • Loading branch information
MeltyPlayer committed Aug 6, 2023
1 parent 217e521 commit 59b2079
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Schema/src/util/types/BSymbolTypeV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private abstract class BSymbolTypeV2 : ITypeV2 {

public abstract bool Implements(Type type, out ITypeV2 matchingType);

public abstract int GenericArgCount { get; }
public abstract int Arity { get; }

public virtual bool HasNullableAnnotation => false;
public abstract bool IsClass { get; }
Expand Down Expand Up @@ -52,12 +52,12 @@ private bool Matches_(string name,
int genericArgCount)
=> this.Name == name &&
this.FullyQualifiedNamespace == fullyQualifiedNamespace &&
this.GenericArgCount == genericArgCount;
this.Arity == genericArgCount;

public bool IsExactly(ITypeV2 other) => this.Matches_(
other.Name,
other.FullyQualifiedNamespace,
other.GenericArgCount);
other.Arity);

public bool IsExactly(Type other) {
var expectedName = other.Name;
Expand Down
2 changes: 1 addition & 1 deletion Schema/src/util/types/ITypeV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public interface ITypeV2 {
bool Implements<T>(out ITypeV2 matchingType);
bool Implements(Type type, out ITypeV2 matchingType);

int GenericArgCount { get; }
int Arity { get; }
bool HasGenericArguments(out IEnumerable<ITypeV2> genericArguments);
IEnumerable<ITypeV2> GenericArguments { get; }
bool HasGenericConstraints(out IEnumerable<ITypeV2> genericConstraints);
Expand Down
4 changes: 2 additions & 2 deletions Schema/src/util/types/SymbolTypeV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private IEnumerable<INamedTypeSymbol> BaseTypes {
}
}

public override int GenericArgCount
public override int Arity
=> (this.symbol_ as INamedTypeSymbol)?.TypeArguments.Length ?? 0;

public override bool IsClass
Expand Down Expand Up @@ -133,7 +133,7 @@ private static SchemaPrimitiveType GetPrimitiveType_(ISymbol symbol) {

public override bool HasGenericArguments(
out IEnumerable<ITypeV2> genericArguments) {
if (this.GenericArgCount == 0) {
if (this.Arity == 0) {
genericArguments = default;
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions Schema/src/util/types/TypeTypeV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private IEnumerable<Type> BaseTypes {
}
}

public override int GenericArgCount
public override int Arity
=> this.type_.GetGenericParameterConstraints().Length;

public override bool IsClass => this.type_.IsClass;
Expand Down Expand Up @@ -109,7 +109,7 @@ public override IEnumerable<TAttribute> GetAttributes<TAttribute>()

public override bool HasGenericArguments(
out IEnumerable<ITypeV2> genericArguments) {
if (this.GenericArgCount == 0) {
if (this.Arity == 0) {
genericArguments = default;
return false;
}
Expand Down

0 comments on commit 59b2079

Please sign in to comment.