Skip to content

Commit f2e4f12

Browse files
committed
Added support for class generated identifiers.
1 parent 7e3ca87 commit f2e4f12

File tree

18 files changed

+228
-130
lines changed

18 files changed

+228
-130
lines changed

ComparisonBenchmarks/ComparisonBenchmarks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<ItemGroup>
1414
<PackageReference Include="BenchmarkDotNet" Version="0.14.0"/>
1515
<PackageReference Include="FluentResults" Version="3.16.0"/>
16-
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0"/>
16+
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />
1717
<PackageReference Include="Rascal" Version="1.1.0"/>
1818
</ItemGroup>
1919

src/LightResults.Extensions.GeneratedIdentifier/GeneratedIdentifierSourceGenerator.cs

Lines changed: 146 additions & 80 deletions
Large diffs are not rendered by default.

src/LightResults.Extensions.GeneratedIdentifier/LightResults.Extensions.GeneratedIdentifier.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<!-- Output -->
3737
<PropertyGroup>
3838
<AssemblyName>LightResults.Extensions.GeneratedIdentifier</AssemblyName>
39-
<Version>9.0.0-preview.4</Version>
39+
<Version>9.0.0-preview.5</Version>
4040
<AssemblyVersion>9.0.0.0</AssemblyVersion>
4141
<FileVersion>9.0.0.0</FileVersion>
4242
<NeutralLanguage>en-US</NeutralLanguage>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
namespace LightResults.Extensions.GeneratedIdentifier.Fixtures.Identifiers;
22

33
[GeneratedIdentifier<string>]
4-
public partial struct TestStringId;
4+
public partial class TestStringId;

tests/LightResults.Extensions.GeneratedIdentifier.Fixtures/LightResults.Extensions.GeneratedIdentifier.Fixtures.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<ItemGroup>
2525
<PackageReference Include="LightResults" Version="9.0.0-preview.15"/>
26-
<PackageReference Include="LightResults.Extensions.ValueObjects" Version="9.0.0-preview.1"/>
26+
<PackageReference Include="LightResults.Extensions.ValueObjects" Version="9.0.0-preview.3"/>
2727
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.10"/>
2828
</ItemGroup>
2929

tests/LightResults.Extensions.GeneratedIdentifier.Tests/GeneratedIdentifierSourceGeneratorTests.GenerateGuidIdentifier_WithNamespace.verified.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ readonly partial struct TestGuidId :
139139
/// <inheritdoc />
140140
public int CompareTo(object? obj)
141141
{
142-
if (ReferenceEquals(null, obj)) return 1;
143-
return obj is TestGuidId other ? CompareTo(other) : throw new ArgumentException($"Object must be of type {nameof(TestGuidId)}");
142+
if (ReferenceEquals(null, obj))
143+
return 1;
144+
return obj is TestGuidId other ? CompareTo(other) : throw new ArgumentException($"Object must be of type {nameof(TestGuidId)}.");
144145
}
145146

146147
/// <summary>Determines whether the first instance of <see cref="TestGuidId" /> is less than the second instance.</summary>

tests/LightResults.Extensions.GeneratedIdentifier.Tests/GeneratedIdentifierSourceGeneratorTests.GenerateGuidIdentifier_WithoutNamespace.verified.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ readonly partial struct TestGuidId :
137137
/// <inheritdoc />
138138
public int CompareTo(object? obj)
139139
{
140-
if (ReferenceEquals(null, obj)) return 1;
141-
return obj is TestGuidId other ? CompareTo(other) : throw new ArgumentException($"Object must be of type {nameof(TestGuidId)}");
140+
if (ReferenceEquals(null, obj))
141+
return 1;
142+
return obj is TestGuidId other ? CompareTo(other) : throw new ArgumentException($"Object must be of type {nameof(TestGuidId)}.");
142143
}
143144

144145
/// <summary>Determines whether the first instance of <see cref="TestGuidId" /> is less than the second instance.</summary>

tests/LightResults.Extensions.GeneratedIdentifier.Tests/GeneratedIdentifierSourceGeneratorTests.GenerateIntIdentifier_WithNamespace.verified.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ readonly partial struct TestIntId :
139139
/// <inheritdoc />
140140
public int CompareTo(object? obj)
141141
{
142-
if (ReferenceEquals(null, obj)) return 1;
143-
return obj is TestIntId other ? CompareTo(other) : throw new ArgumentException($"Object must be of type {nameof(TestIntId)}");
142+
if (ReferenceEquals(null, obj))
143+
return 1;
144+
return obj is TestIntId other ? CompareTo(other) : throw new ArgumentException($"Object must be of type {nameof(TestIntId)}.");
144145
}
145146

146147
/// <summary>Determines whether the first instance of <see cref="TestIntId" /> is less than the second instance.</summary>

tests/LightResults.Extensions.GeneratedIdentifier.Tests/GeneratedIdentifierSourceGeneratorTests.GenerateIntIdentifier_WithoutNamespace.verified.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ readonly partial struct TestIntId :
137137
/// <inheritdoc />
138138
public int CompareTo(object? obj)
139139
{
140-
if (ReferenceEquals(null, obj)) return 1;
141-
return obj is TestIntId other ? CompareTo(other) : throw new ArgumentException($"Object must be of type {nameof(TestIntId)}");
140+
if (ReferenceEquals(null, obj))
141+
return 1;
142+
return obj is TestIntId other ? CompareTo(other) : throw new ArgumentException($"Object must be of type {nameof(TestIntId)}.");
142143
}
143144

144145
/// <summary>Determines whether the first instance of <see cref="TestIntId" /> is less than the second instance.</summary>

tests/LightResults.Extensions.GeneratedIdentifier.Tests/GeneratedIdentifierSourceGeneratorTests.GenerateLongIdentifier_WithNamespace.verified.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ readonly partial struct TestLongId :
139139
/// <inheritdoc />
140140
public int CompareTo(object? obj)
141141
{
142-
if (ReferenceEquals(null, obj)) return 1;
143-
return obj is TestLongId other ? CompareTo(other) : throw new ArgumentException($"Object must be of type {nameof(TestLongId)}");
142+
if (ReferenceEquals(null, obj))
143+
return 1;
144+
return obj is TestLongId other ? CompareTo(other) : throw new ArgumentException($"Object must be of type {nameof(TestLongId)}.");
144145
}
145146

146147
/// <summary>Determines whether the first instance of <see cref="TestLongId" /> is less than the second instance.</summary>

0 commit comments

Comments
 (0)