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

Fix: incorrect TypeMismatch when dealing with literals in lists #2309

Merged
merged 2 commits into from Feb 16, 2021

Conversation

iamdefinitelyahuman
Copy link
Contributor

What I did

Fix an issue preventing literal lists where some members are literals and others are not. For example:

@external
def foo() -> uint256[2]:
    a: uint256 = 123
    return [a, 2]

This would fail because in parser/stmt.py the literal 2 is interpreted as an int128. However, we know this to be incorrect because we have already completed the type checking pass.

How I did it

Remove the now-redundant check that was blocking this at compile-time. I did some minor voodoo to retain the type information within parser so that nothing else breaks later down the line, and left a comment to prevent confusion later when we refactor types out altogether.

How to verify it

Check that tests are passing.

Cute Animal Picture

image

@fubuloubu fubuloubu merged commit 55ce71b into vyperlang:master Feb 16, 2021
@iamdefinitelyahuman iamdefinitelyahuman deleted the fix-list-literals branch February 16, 2021 23:50
@iamdefinitelyahuman iamdefinitelyahuman restored the fix-list-literals branch February 16, 2021 23:50
@iamdefinitelyahuman iamdefinitelyahuman deleted the fix-list-literals branch February 16, 2021 23:50
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.

None yet

2 participants