You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fnfoo(b: bool) u16 {
if(b)
return@as(u8, 0xFF);
return0xFFFF; // error: integer value 65535 cannot be coerced to type 'u8'
}
pubfnmain() !void
{
_=foo(true);
}
I think there is something fishy going on as the function has an explicit return type but somehow deduces that the return type is u8 instead of u16.
Workaround: use @as() to coerce the value in the return to the correct return type
The text was updated successfully, but these errors were encountered:
Vexu
added
bug
Observed behavior contradicts documented or intended behavior
stage1
The process of building from source via WebAssembly and the C backend.
labels
Apr 20, 2020
I think there is something fishy going on as the function has an explicit return type but somehow deduces that the return type is
u8
instead ofu16
.Workaround: use
@as()
to coerce the value in the return to the correct return typeThe text was updated successfully, but these errors were encountered: