Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow void values in if expressions #1159

Closed
degory opened this issue Apr 10, 2024 · 0 comments · Fixed by #1164
Closed

Allow void values in if expressions #1159

degory opened this issue Apr 10, 2024 · 0 comments · Fixed by #1164

Comments

@degory
Copy link
Owner

degory commented Apr 10, 2024

Allow if expressions to return void values when in a context where void is expected, for example as the body of a function returning void.

print_size(v: int) =>
    if v > 10 then
        write_line("big")
    else
        write_line("small")
    fi;

As the result is not actually consumed, we can allow void if expressions with no else

print_size_if_big(v: int) =>
    if v > 10 then
        write_line("big")
    fi;
degory added a commit that referenced this issue Apr 10, 2024
Enhancements:
- Allow void values in if expressions (closes #1159)
- Pass type constraints through if let and nested if (closes #1160)

Bugs fixed:
- Signature help not available for constructor calls without new (closes #1161)
- let in not accepted in return statement (closes #1162)
- Lambdas cannot infer void return type (closes #1163)
degory added a commit that referenced this issue Apr 10, 2024
Enhancements:
- Allow void values in if expressions (closes #1159)
- Pass type constraints through if let and nested if (closes #1160)

Bugs fixed:
- Signature help not available for constructor calls without new (closes #1161)
- let in not accepted in return statement (closes #1162)
- Lambdas cannot infer void return type (closes #1163)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

1 participant