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

Member variables not working #211

Closed
jplevyak opened this issue Mar 11, 2023 · 2 comments
Closed

Member variables not working #211

jplevyak opened this issue Mar 11, 2023 · 2 comments

Comments

@jplevyak
Copy link

class A:
  def __init__(self):
    self.x = 3
print(A().x)

produces

x.py:3:5-9: error: 'A' object has no attribute 'x'
╰─ x.py:4:7-12: error: during the realization of init(self: A)

@arshajii
Copy link
Contributor

Currently the class members need to be listed similar to Python's data classes (docs for reference). We do support deducing members right now if you add the @deduce annotation on the class (although it's limited to __init__); we'll likely update/generalize this in a future version to be more in line with Python.

@inumanag
Copy link
Contributor

inumanag commented Nov 8, 2024

Please see #606 to track the implementation progress.

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

No branches or pull requests

3 participants