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

[Bug] Runtime error accessing baz in init method of Foo #1371

Open
musab-mah-7 opened this issue Oct 12, 2024 · 0 comments
Open

[Bug] Runtime error accessing baz in init method of Foo #1371

musab-mah-7 opened this issue Oct 12, 2024 · 0 comments
Labels
bug Something isn't working as expected. jaclang Issues related to jac programming language

Comments

@musab-mah-7
Copy link
Collaborator

Describe the bug

In the object definition for Foo, the attempt to access self.baz within the init method results in a runtime error indicating that Foo has no baz, despite it being declared. This inconsistency should be addressed.

To Reproduce

  1. Define an object Foo with has baz: int = 0;.
  2. Access self.baz in the init method.
  3. Run the code.
obj Foo {
    has bar: str;
    has baz: int = 0;

    can init(bar: str) {
        self.bar = bar;
        print(self.baz); # <-- Run time error Foo has no baz.
    }
}

Expected Outcome:

The baz attribute should be accessible in the init method without any runtime errors.

@musab-mah-7 musab-mah-7 added bug Something isn't working as expected. jaclang Issues related to jac programming language labels Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected. jaclang Issues related to jac programming language
Projects
None yet
Development

No branches or pull requests

1 participant