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

Checker cannot deal with type alias #329

Open
JSAbrahams opened this issue May 29, 2022 · 1 comment · Fixed by #340
Open

Checker cannot deal with type alias #329

JSAbrahams opened this issue May 29, 2022 · 1 comment · Fixed by #340
Assignees
Labels
bug: check Something in the type check module isn't working (as intended)

Comments

@JSAbrahams
Copy link
Owner

Description of Bug

Checker cannot deal with type alias.

How to Reproduce

when checking

type MyType: String

def a: MyType := "my_string"
print(a)

We get Unifying two types: Expected a 'MyType', was a 'String'

Expected behavior

If something is an alias, then we should check for the alias type and not the type itself.

@JSAbrahams JSAbrahams added the bug: check Something in the type check module isn't working (as intended) label May 29, 2022
@JSAbrahams JSAbrahams added this to the Match statements (v0.3.3) milestone May 29, 2022
@JSAbrahams JSAbrahams self-assigned this May 29, 2022
@JSAbrahams JSAbrahams linked a pull request May 31, 2022 that will close this issue
@JSAbrahams
Copy link
Owner Author

Within the current language, it actually makes sense that this does not pass.
As it is writting, MyType is a child of String, which should make the checker fail.
If we had def a: String = MyType(...), then it would pass, because the left side is the parent of the right side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: check Something in the type check module isn't working (as intended)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant