Skip to content

Commit 3adf057

Browse files
committed
Fix test: wrap VB methods in class for Issue886 optional struct ref
Methods cannot appear at file level in VB.NET. Wrap in Class C and update expected C# output accordingly. https://claude.ai/code/session_01AkwUvu3XuCdj3D4axoX4UX
1 parent 393c182 commit 3adf057

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

Tests/CSharp/ExpressionTests/ByRefTests.cs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -969,25 +969,30 @@ public async Task OptionalStructRefParameterUsesDefaultNotNullIssue886Async()
969969
await TestConversionVisualBasicToCSharpAsync(@"
970970
Structure S
971971
End Structure
972-
Sub Foo(Optional ByRef s As S = Nothing)
973-
End Sub
974-
Sub Bar()
975-
Foo()
976-
End Sub
972+
Class C
973+
Sub Foo(Optional ByRef s As S = Nothing)
974+
End Sub
975+
Sub Bar()
976+
Foo()
977+
End Sub
978+
End Class
977979
", @"using System.Runtime.InteropServices;
978980
979981
internal partial struct S
980982
{
981983
}
982984
983-
public void Foo([Optional] ref S s)
985+
internal partial class C
984986
{
985-
}
987+
public void Foo([Optional] ref S s)
988+
{
989+
}
986990
987-
public void Bar()
988-
{
989-
S args = default;
990-
Foo(s: ref args);
991+
public void Bar()
992+
{
993+
S args = default;
994+
Foo(s: ref args);
995+
}
991996
}");
992997
}
993998

0 commit comments

Comments
 (0)