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

Parentheses around type assertions removed leading to incorrect semantics #441

Closed
JohnnyMorganz opened this issue Apr 11, 2022 · 2 comments · Fixed by #443
Closed

Parentheses around type assertions removed leading to incorrect semantics #441

JohnnyMorganz opened this issue Apr 11, 2022 · 2 comments · Fixed by #443
Labels
bug Something isn't working

Comments

@JohnnyMorganz
Copy link
Owner

if string.len(string_) > (length :: number) then
    return string_:sub(1, (length :: number) + 1) .. ""
else
    return string_
end

... gets formatted as ...

if string.len(string_) > length :: number then
    return string_:sub(1, length :: number + 1) .. ""
else
    return string_
end
@JohnnyMorganz JohnnyMorganz added the bug Something isn't working label Apr 11, 2022
@JohnnyMorganz
Copy link
Owner Author

Actually, I don't think these are invalid...

@JohnnyMorganz
Copy link
Owner Author

JohnnyMorganz commented Apr 11, 2022

This one is definitely invalid though:

if fiber.actualStartTime ~= nil and (fiber.actualStartTime :: number) < 0 then
    fiber.actualStartTime = now()
end

... gets formatted as ...

if fiber.actualStartTime ~= nil and fiber.actualStartTime :: number < 0 then
    fiber.actualStartTime = now()
end

which is actually a syntax error since its now expecting a generic

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

Successfully merging a pull request may close this issue.

1 participant