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

None sans Optional devrait provoquer une erreur #182

Open
fgallaire opened this issue Oct 10, 2022 · 1 comment
Open

None sans Optional devrait provoquer une erreur #182

fgallaire opened this issue Oct 10, 2022 · 1 comment
Labels
todo (pstl) special label for student projects

Comments

@fgallaire
Copy link

fgallaire commented Oct 10, 2022

not None est évalué comme True, et lorsque None est renvoyé
de manière implicite par Python et non de manière explicite dans un
return, MrPython ne relève pas le problème de typage. Cela pose un
problème pour les tests des fonctions booléennes :

def test() -> bool:
    """"""
    if 1 > 2:
        return True

assert not test()
assert test() == False

Un retour implicite de None sans Optional devrait provoquer une erreur.

@fredokun
Copy link
Collaborator

this one is tricky ... because the actual python interpreter is running the programs, not an instrumented one. A partial static analysis could help (in fact, a program graph analysis was planned at some point)

@fredokun fredokun added the todo (pstl) special label for student projects label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
todo (pstl) special label for student projects
Projects
None yet
Development

No branches or pull requests

2 participants