Skip to content

Commit 243ad9a

Browse files
antonsyndclaude
andcommitted
chore: deduplicate GenerateSomeExpression and relocate misplaced test fixture
GenerateSomeExpression now delegates to WrapInOptionalSome instead of duplicating the Optional<T>.Some() SyntaxFactory pattern. Moved property_getter_fstring_format fixture into TestFixtures/properties/ for consistency with other property tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 230218a commit 243ad9a

File tree

3 files changed

+1
-12
lines changed

3 files changed

+1
-12
lines changed

src/Sharpy.Compiler.Tests/Integration/TestFixtures/property_getter_fstring_format.expected renamed to src/Sharpy.Compiler.Tests/Integration/TestFixtures/properties/property_getter_fstring_format.expected

File renamed without changes.

src/Sharpy.Compiler.Tests/Integration/TestFixtures/property_getter_fstring_format.spy renamed to src/Sharpy.Compiler.Tests/Integration/TestFixtures/properties/property_getter_fstring_format.spy

File renamed without changes.

src/Sharpy.Compiler/CodeGen/RoslynEmitter.Expressions.Access.cs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,18 +1122,7 @@ private ExpressionSyntax WrapInOptionalSome(ExpressionSyntax value, OptionalType
11221122
/// Generates: Optional&lt;T&gt;.Some(value)
11231123
/// </summary>
11241124
private ExpressionSyntax GenerateSomeExpression(FunctionCall call, OptionalType opt)
1125-
{
1126-
var underlyingType = _typeMapper.MapSemanticType(opt.UnderlyingType);
1127-
var arg = GenerateExpression(call.Arguments[0]);
1128-
1129-
return InvocationExpression(
1130-
MemberAccessExpression(
1131-
SyntaxKind.SimpleMemberAccessExpression,
1132-
GenericName("Optional")
1133-
.WithTypeArgumentList(TypeArgumentList(SingletonSeparatedList(underlyingType))),
1134-
IdentifierName("Some")))
1135-
.WithArgumentList(ArgumentList(SingletonSeparatedList(Argument(arg))));
1136-
}
1125+
=> WrapInOptionalSome(GenerateExpression(call.Arguments[0]), opt);
11371126

11381127
/// <summary>
11391128
/// Generates: Result&lt;T, E&gt;.Ok(value)

0 commit comments

Comments
 (0)