Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

[BUG] Mypy is generating a false type error for class constructor #288

Open
mgtm98 opened this issue Mar 13, 2024 · 0 comments
Open

[BUG] Mypy is generating a false type error for class constructor #288

mgtm98 opened this issue Mar 13, 2024 · 0 comments
Assignees
Labels
bug fix Something isn't working mypy

Comments

@mgtm98
Copy link
Collaborator

mgtm98 commented Mar 13, 2024

Describe the bug
The following jac code is giving a type error for constructor arguments types
Jac Code

obj Person {
    has : protect age: int; # no need ot use `_age`
    has : pub name: str;

    can : priv init(name: str, age: int) -> None {
        here.name = name;
        here.age = age;
    }

    can : pub greet() -> None { # public is default if `pub` is not specified

    print("Hello, my name is ", self.name, " and I'm ", self.age, " years old.");
    }
}

mypy errors

WARNING - /home/mgtm98/jaclang/examples/micro/basic_class.jac, line 19, col 21: Argument 1 to "Person" has incompatible type "str"; expected "int"
WARNING - /home/mgtm98/jaclang/examples/micro/basic_class.jac, line 19, col 29: Argument 2 to "Person" has incompatible type "int"; expected "str"
@mgtm98 mgtm98 added the bug fix Something isn't working label Mar 13, 2024
@mgtm98 mgtm98 self-assigned this Mar 13, 2024
@mgtm98 mgtm98 added the mypy label Mar 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fix Something isn't working mypy
Projects
None yet
Development

No branches or pull requests

1 participant