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

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

Closed
fubuloubu opened this Issue Sep 19, 2018 · 3 comments

Comments

2 participants
@fubuloubu
Member

fubuloubu commented Sep 19, 2018

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

@jacqueswww

This comment has been minimized.

Contributor

jacqueswww commented Sep 20, 2018

Yes agree, moving to convert(a, int128) without quotes is the way to go.

@jacqueswww jacqueswww added the Approved label Oct 2, 2018

@jacqueswww jacqueswww added this to To do in Fix the Beta via automation Oct 2, 2018

@jacqueswww

This comment has been minimized.

Contributor

jacqueswww commented Oct 2, 2018

Starting on this.

@fubuloubu

This comment has been minimized.

Member

fubuloubu commented Oct 2, 2018

cc @haydenadams

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment