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

Nonsense struct output with inline returns #1551

Closed
NoahZinsmeister opened this issue Jul 24, 2019 · 0 comments · Fixed by #1552
Closed

Nonsense struct output with inline returns #1551

NoahZinsmeister opened this issue Jul 24, 2019 · 0 comments · Fixed by #1552
Labels
bug Bug that shouldn't change language semantics when fixed.

Comments

@NoahZinsmeister
Copy link

NoahZinsmeister commented Jul 24, 2019

Version Information

  • vyper Version (output of vyper --version): 0.1.0b10
  • OS: osx
  • Python Version (output of python --version): Python 3.7.2
  • Environment (output of pip freeze):
eth-tester==0.1.0b39
py-evm==0.2.0a42
pytest==5.0.1
vyper==0.1.0b10
web3==5.0.0b2

What's your issue about?

When @public functions which return structs are returned inline from other @public functions, the output is nonsense values.

In the following code, wrap_get_my_struct_WORKING returns the correct data, whereas wrap_get_my_struct_BROKEN returns nonsense.

struct MyStruct:
    e1: decimal
    e2: timestamp


# @dev Construct a MyStruct.
@public
@constant
def get_my_struct(_e1: decimal, _e2: timestamp) -> MyStruct:
    return MyStruct({e1: _e1, e2: _e2})
 

# @dev Wrap self.get_my_struct.
@public
@constant
def wrap_get_my_struct_WORKING(_e1: decimal) -> MyStruct:
    testing: MyStruct = self.get_my_struct(_e1, block.timestamp)
    return testing

# @dev Wrap self.get_my_struct.
@public
@constant
def wrap_get_my_struct_BROKEN(_e1: decimal) -> MyStruct:
    return self.get_my_struct(_e1, block.timestamp)
@NoahZinsmeister NoahZinsmeister changed the title Nonsense Struct returns Nonsense struct output with inline returns Jul 24, 2019
@jacqueswww jacqueswww added the bug Bug that shouldn't change language semantics when fixed. label Jul 24, 2019
NoahZinsmeister added a commit to NoahZinsmeister/oracle that referenced this issue Jul 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that shouldn't change language semantics when fixed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants