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

Can't call an internal function from constructor #2251

Closed
banteg opened this issue Dec 10, 2020 · 2 comments
Closed

Can't call an internal function from constructor #2251

banteg opened this issue Dec 10, 2020 · 2 comments
Labels
bug Bug that shouldn't change language semantics when fixed.

Comments

@banteg
Copy link

banteg commented Dec 10, 2020

Version Information

  • vyper Version (output of vyper --version): 0.2.8
  • OS: osx
  • Python Version (output of python --version): 3.8.2
  • Environment (output of pip freeze):

What's your issue about?

@internal
def initialize():
    ...

@external
def __init__():
    self.initialize()
Compiling contracts...
  Vyper version: 0.2.8
Unhandled exception in 'contracts/Vault.vy':
FunctionDeclarationException: Function not declared yet (reminder: functions cannot call functions later in code than themselves): initialize

How can it be fixed?

Allow calling internal functions from constructor.

@fubuloubu fubuloubu added the bug Bug that shouldn't change language semantics when fixed. label Dec 10, 2020
@fubuloubu
Copy link
Member

Solution is to inline the internal method into the deployment constructor. This is useful for being able to deploy proxies

@charles-cooper
Copy link
Member

I believe this is a dup of #1631

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

No branches or pull requests

3 participants