Skip to content

Convert function takes string instead of type for conversion to #1026

@fubuloubu

Description

@fubuloubu

What's your issue about?

If you forget to add quotes to the type you want to convert to, Vyper will give an unhelpful error:

convert(some_int128, uint256)
# raises:
#    AttributeError: 'Name' object has no attribute 's'

How can it be fixed?

So, catching this error might work out to fix this issue, but I think the underlying issue is that the second argument (convertTo) is a string instead of a typename. This actually makes it a little more unintuitive to write conversions as you could misspell the name and not get visual feedback from your IDE (assuming you have syntax highlighting up)

I would suggest turning this into a VIP to modify the syntax of convert such that a valid typename is supplied as the second argument

Cute Animal Picture

pony

Metadata

Metadata

Assignees

No one assigned

    Labels

    VIP: ApprovedVIP ApprovedVIP: DiscussionUsed to denote VIPs and more complex issues that are waiting discussion in a meeting

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions