Skip to content

Commit

Permalink
Fixed bug in implicit operator generation, causing '._value' is inacc…
Browse files Browse the repository at this point in the history
…essible due to its protection level error in compiler
  • Loading branch information
GregoryNikolaishvili committed Mar 11, 2024
1 parent 14de232 commit fa4a112
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/AltaSoft.DomainPrimitives.Generator/Executor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ private static void GenerateImplicitOperators(GeneratorData data, SourceCodeBuil
.AppendLine("[MethodImpl(MethodImplOptions.AggressiveInlining)]")
.AppendLine("[return: NotNullIfNotNull(nameof(value))]")
.Append($"public static implicit operator {className}?({parentClassName}? value)")
.AppendLine($" => value is null ? null : ({className}?)value{(type.IsValueType ? ".Value" : "")}.{data.FieldName};")
.AppendLine($" => value is null ? null : ({className}?)value{(type.IsValueType ? ".Value" : "")};")
.NewLine();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public int CompareTo(object? obj)
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[return: NotNullIfNotNull(nameof(value))]
public static implicit operator IntOfIntValue?(IntValue? value) => value is null ? null : (IntOfIntValue?)value.Value._value;
public static implicit operator IntOfIntValue?(IntValue? value) => value is null ? null : (IntOfIntValue?)value.Value;

/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public int CompareTo(object? obj)
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[return: NotNullIfNotNull(nameof(value))]
public static implicit operator StringOfStringValue?(StringValue? value) => value is null ? null : (StringOfStringValue?)value._value;
public static implicit operator StringOfStringValue?(StringValue? value) => value is null ? null : (StringOfStringValue?)value;

/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down

0 comments on commit fa4a112

Please sign in to comment.