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
This is not related to a specific function. Writing return statements within if statements that rely on a runtime conditional is not supported at this point. This can be avoided by writing a single return at the end.
I pushed an update that generates an error message in the editor directly to indicate that this is not supported.
Thank you! Storing the result in a variable and simply returning that variable works.
If return statements are difficult, maybe you could instead support the ternary operator for XJSnark types. My initial attempt was:
return a > b ? a : b;
This avoids a return in a conditional block perfectly well and it seems to me that return statements are often written using the ternary operator because a case differentiation involving an if statement for the last statement of a function is unnecessarily cumbersome. However, the problem is that this currently yields the following error message:
Error: Boolean and JBoolean are inconsistent types.
As the error message implies, this is not dependent on the resulting value being used in a return statement.
Steps to reproduce
Paste the following function into any XJSnark program:
The bug occurs regardless of whether this function is ever invoked.
It results in the following compilation problem:
The text was updated successfully, but these errors were encountered: