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

assert True --> weird warning #480

Open
Akuli opened this issue Dec 25, 2023 · 2 comments
Open

assert True --> weird warning #480

Akuli opened this issue Dec 25, 2023 · 2 comments

Comments

@Akuli
Copy link
Owner

Akuli commented Dec 25, 2023

def main() -> int:
    assert True
    return 0

this outputs:

compiler warning for file "asd.jou", line 2: this code will never run

The error message is misleading. The code does run, it just never fails the assert. Something like condition of 'assert' is always True would be much better.

When the error message says "this code", it means the code for handling failed assertions. The code above is equivalent to:

import "stdlib/_assert_fail.jou"

def main() -> int:
    if not True:
        _jou_assert_fail("True", "asd.jou", 2)
    return 0
@littlewhitecloud
Copy link
Contributor

Or the assert statement doesn't make sense here?

@Moosems
Copy link

Moosems commented Dec 29, 2023

Misleading yes, but why would you be doing assert True? I could understand assert True == True and the former giving an error like assert lacks conditional statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants