Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DomainModeling.Generator/DomainModeling.Generator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4">
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0" PrivateAssets="all" />
</ItemGroup>

</Project>
9 changes: 3 additions & 6 deletions DomainModeling.Generator/TypeSymbolExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ internal static class TypeSymbolExtensions
{
private const string ComparisonsNamespace = "Architect.DomainModeling.Comparisons";

private static IReadOnlyCollection<string> ConversionOperatorNames { get; } = new[]
{
"op_Implicit", "op_Explicit",
};
private static IReadOnlyCollection<string> ConversionOperatorNames { get; } = ["op_Implicit", "op_Explicit",];

/// <summary>
/// Returns whether the <see cref="ITypeSymbol"/> is of type <typeparamref name="T"/>.
Expand Down Expand Up @@ -391,7 +388,7 @@ public static ITypeSymbol ExtractNonArrayElementType(this IArrayTypeSymbol array
/// <summary>
/// Returns whether the <see cref="ITypeSymbol"/> or a base type has an override of <see cref="Object.Equals(Object)"/> more specific than <see cref="Object"/>'s implementation.
/// </summary>
public static bool HasEqualsOverride(this ITypeSymbol typeSymbol, bool falseForStructs = false)
public static bool HasEqualsOverride(this ITypeSymbol typeSymbol)
{
// Technically this could match an overridden "new" Equals defined by a base type, but that is a nonsense scenario
var result = typeSymbol.GetMembers(nameof(Object.Equals)).OfType<IMethodSymbol>().Any(method => method.IsOverride && !method.IsStatic &&
Expand Down Expand Up @@ -623,7 +620,7 @@ public static string CreateComparisonExpression(this ITypeSymbol typeSymbol, str
/// <param name="symbolName">The name of the member/parameter/... to instantiate an instance for. May be used as the dummy string value if applicable.</param>
public static string CreateDummyInstantiationExpression(this ITypeSymbol typeSymbol, string symbolName)
{
return typeSymbol.CreateDummyInstantiationExpression(symbolName, Array.Empty<ITypeSymbol>(), _ => null!);
return typeSymbol.CreateDummyInstantiationExpression(symbolName, [], _ => null!);
}

/// <summary>
Expand Down
58 changes: 29 additions & 29 deletions DomainModeling.Generator/TypeSyntaxExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
using Microsoft.CodeAnalysis.CSharp.Syntax;

namespace Architect.DomainModeling.Generator;

/// <summary>
/// Provides extensions on <see cref="TypeSyntax"/>.
/// </summary>
internal static class TypeSyntaxExtensions
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace Architect.DomainModeling.Generator;
/// <summary>
/// Provides extensions on <see cref="TypeSyntax"/>.
/// </summary>
internal static class TypeSyntaxExtensions
{
/// <summary>
/// Returns whether the given <see cref="TypeSyntax"/> has the given arity (type parameter count) and (unqualified) name.
/// </summary>
/// <param name="arity">Pass null to accept any arity.</param>
public static bool HasArityAndName(this TypeSyntax typeSyntax, int? arity, string unqualifiedName)
public static bool HasArityAndName(this TypeSyntax typeSyntax, int? arity, string unqualifiedName)
{
return TryGetArityAndUnqualifiedName(typeSyntax, out var actualArity, out var actualUnqualifiedName) &&
(arity is null || actualArity == arity) &&
actualUnqualifiedName == unqualifiedName;
actualUnqualifiedName == unqualifiedName;
}

/// <summary>
/// Returns whether the given <see cref="TypeSyntax"/> has the given arity (type parameter count) and (unqualified) name suffix.
/// </summary>
/// <param name="arity">Pass null to accept any arity.</param>
public static bool HasArityAndNameSuffix(this TypeSyntax typeSyntax, int? arity, string unqualifiedName)
public static bool HasArityAndNameSuffix(this TypeSyntax typeSyntax, int? arity, string unqualifiedName)
{
return TryGetArityAndUnqualifiedName(typeSyntax, out var actualArity, out var actualUnqualifiedName) &&
(arity is null || actualArity == arity) &&
actualUnqualifiedName.EndsWith(unqualifiedName);
actualUnqualifiedName.EndsWith(unqualifiedName);
}

private static bool TryGetArityAndUnqualifiedName(TypeSyntax typeSyntax, out int arity, out string unqualifiedName)
{
if (typeSyntax is SimpleNameSyntax simpleName)
{
arity = simpleName.Arity;
unqualifiedName = simpleName.Identifier.ValueText;
}
else if (typeSyntax is QualifiedNameSyntax qualifiedName)
{
arity = qualifiedName.Arity;
unqualifiedName = qualifiedName.Right.Identifier.ValueText;
}
else if (typeSyntax is AliasQualifiedNameSyntax aliasQualifiedName)
{
arity = aliasQualifiedName.Arity;
unqualifiedName = aliasQualifiedName.Name.Identifier.ValueText;
{
if (typeSyntax is SimpleNameSyntax simpleName)
{
arity = simpleName.Arity;
unqualifiedName = simpleName.Identifier.ValueText;
}
else if (typeSyntax is QualifiedNameSyntax qualifiedName)
{
arity = qualifiedName.Arity;
unqualifiedName = qualifiedName.Right.Identifier.ValueText;
}
else if (typeSyntax is AliasQualifiedNameSyntax aliasQualifiedName)
{
arity = aliasQualifiedName.Arity;
unqualifiedName = aliasQualifiedName.Name.Identifier.ValueText;
}
else
{
Expand All @@ -68,5 +68,5 @@ private static bool TryGetArityAndUnqualifiedName(TypeSyntax typeSyntax, out int
AliasQualifiedNameSyntax aliasQualifiedName => aliasQualifiedName.Name.Identifier.ValueText,
_ => null,
};
}
}
}
}
10 changes: 5 additions & 5 deletions DomainModeling.Tests/DomainModeling.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion DomainModeling/Configuration/IDomainEventConfigurator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ void ConfigureDomainEvent<

public readonly struct Args
{
public bool HasDefaultConstructor { get; init; }
public readonly bool HasDefaultConstructor { get; init; }
}
}
6 changes: 5 additions & 1 deletion DomainModeling/DomainModeling.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@
</ItemGroup>

<PropertyGroup>
<VersionPrefix>3.0.2</VersionPrefix>
<VersionPrefix>3.0.3</VersionPrefix>
<Description>
A complete Domain-Driven Design (DDD) toolset for implementing domain models, including base types and source generators.

https://github.com/TheArchitectDev/Architect.DomainModeling

Release notes:

3.0.3:

- Enhancement: Upgraded package versions.

3.0.2:

- Bug fix.
Expand Down