-
-
Notifications
You must be signed in to change notification settings - Fork 805
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: typechecking of folded builtins (#3490)
some builtins would allow decimals during typechecking and then panic during codegen --------- Co-authored-by: Tanguy Rocher <tanguy.rocher@protonmail.com>
- Loading branch information
Showing
2 changed files
with
34 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import pytest | ||
|
||
from vyper.exceptions import InvalidType | ||
|
||
fail_list = [ | ||
( # bad AST nodes given as arguments | ||
""" | ||
@external | ||
def foo() -> uint256: | ||
return uint256_addmod(1.1, 1.2, 3.0) | ||
""", | ||
InvalidType, | ||
), | ||
( # bad AST nodes given as arguments | ||
""" | ||
@external | ||
def foo() -> uint256: | ||
return uint256_mulmod(1.1, 1.2, 3.0) | ||
""", | ||
InvalidType, | ||
), | ||
] | ||
|
||
|
||
@pytest.mark.parametrize("code,exc", fail_list) | ||
def test_add_mod_fail(assert_compile_failed, get_contract, code, exc): | ||
assert_compile_failed(lambda: get_contract(code), exc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters