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

Throwing exceptions and always_use_return = true interaction #835

Open
omus opened this issue May 17, 2024 · 0 comments
Open

Throwing exceptions and always_use_return = true interaction #835

omus opened this issue May 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@omus
Copy link

omus commented May 17, 2024

At the moment when using a style with always_use_return = true with a function which never returns (always throws an exception) produces misleading code in that it appears that the error or throw functions actually return a value:

julia> using JuliaFormatter

julia> code = """
           function f()
               error("oh no")
           end
           """
"function f()\n    error(\"oh no\")\nend\n"

julia> print(format_text(code, YASStyle()))
function f()
    return error("oh no")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants