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 boolean as default parameter #1466

Merged
merged 1 commit into from
Jun 25, 2019

Conversation

charles-cooper
Copy link
Member

What I did

Fix #1464

How I did it

How to verify it

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@jacqueswww
Copy link
Contributor

Add test and change and this can be merged :)

@charles-cooper
Copy link
Member Author

@jacqueswww I agree that using is_literal is more natural, but the values for defaults don't get parsed until much later (parse_[private,public]_function.py), I am hesitant to move the type checker code to that stage, and I also don't want to do extra calls to parse to LLL since there may be unintended side-effects. Maybe I can introduce a function for determining if an AST node is a literal?

@charles-cooper
Copy link
Member Author

It's also a little awkward, because I don't think the current check descends into the AST node anyways. For example this compiles:

x: int128

@public
def test(a: bool = True) -> bool:
    return a

@public
def test2(a: int128[3] = [1, self.x, 3]):
    pass

@jacqueswww
Copy link
Contributor

@charles-cooper you are right, let's leave as is.

@jacqueswww jacqueswww merged commit 7c7ec86 into vyperlang:master Jun 25, 2019
@charles-cooper charles-cooper deleted the bool_default branch September 24, 2019 11:49
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

Successfully merging this pull request may close these issues.

Bool default parameters not working
2 participants