Skip to content

Commit dbd8945

Browse files
committed
Follow-Up: Returning a ValueTuple<> with more than 4 type arguments requires to use the overload taking a Delegate.
1 parent cf649b6 commit dbd8945

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/Function.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1908,7 +1908,7 @@ internal static TypeHandle GetFunctionType(Type type, List<ValueKind> parameters
19081908

19091909
if (returnsTuple && !allowTuple)
19101910
{
1911-
throw new ArgumentException("Use a different overload that implicitly returns ValueTuple.");
1911+
throw new ArgumentException($"Use a different overload that implicitly returns ValueTuple, or the overload taking a {nameof(Delegate)}.");
19121912
}
19131913

19141914
return new Function.TypeHandle(Function.Native.wasm_functype_new(new ValueTypeArray(parameters), new ValueTypeArray(results)));

tests/FunctionTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ public FunctionTests(FunctionsFixture fixture)
3434

3535
Linker.Define("env", "return_i32", Function.FromCallback(Store, GetBoundFuncIntDelegate()));
3636

37-
Linker.Define("env", "return_15_values", Function.FromCallback(Store, () =>
37+
Linker.Define("env", "return_15_values", Function.FromCallback(Store, (Delegate)(() =>
3838
{
3939
return (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
40-
}));
40+
})));
4141

4242
Linker.Define("env", "accept_15_values", Function.FromCallback(Store,
4343
(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15) =>

tests/LinkerFunctionsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ public LinkerFunctionTests(LinkerFunctionsFixture fixture)
3333

3434
Linker.Define("env", "return_i32", Function.FromCallback(Store, GetBoundFuncIntDelegate()));
3535

36-
Linker.Define("env", "return_15_values", Function.FromCallback(Store, () =>
36+
Linker.Define("env", "return_15_values", Function.FromCallback(Store, (Delegate)(() =>
3737
{
3838
return (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
39-
}));
39+
})));
4040

4141
Linker.Define("env", "accept_15_values", Function.FromCallback(Store,
4242
(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15) =>

0 commit comments

Comments
 (0)