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

Add contract name to exceptions #2103

Merged

Conversation

iamdefinitelyahuman
Copy link
Contributor

What I did

  • Display the name of the active contract when raising an exception. This is useful when an exception occurs while parsing an interface.
  • Ensure the correct annotation shows when parsing interfaces.

How I did it

  • Add a name field to the Module AST node. This gets added via a new kwarg for parse_to_ast
  • Include the contract_name kwarg when generating ASTs in compiler and signatures

How to verify it

Cause an exception. It should give output like this:

UnknownType: Not a valid type - value is undeclared
contract "cERC20", function "transfer", line 21:18 
     20 @external
---> 21 def transfer(_to: oopsie, _value: uint256) -> bool:
--------------------------^
     22     pass

Cute Animal Picture

image

@iamdefinitelyahuman iamdefinitelyahuman merged commit e4dfbbf into vyperlang:master Jul 6, 2020
@iamdefinitelyahuman iamdefinitelyahuman deleted the feat-contract-name branch July 6, 2020 14:27
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.

2 participants