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

type checking does not play well with imports #722

Closed
NoamDev opened this issue Sep 30, 2024 · 5 comments · Fixed by #723
Closed

type checking does not play well with imports #722

NoamDev opened this issue Sep 30, 2024 · 5 comments · Fixed by #723
Labels
bug Something isn't working compilation Compilation of terms and functions to HVM

Comments

@NoamDev
Copy link

NoamDev commented Sep 30, 2024

Reproducing the behavior

Example:
Running command: bend check main.bend
With code:

a.bend

type MyType:
  A

Foo: MyType -> MyType

(Foo MyType/A) = MyType/A

main.bend

from a import *
main = "hello world"

Error.:

Errors:
In a :
In definition 'a/Foo':
  Type Error: Expected function type '(a/MyType -> a/MyType)' but found '(MyType -> a/MyType)'.

Expected behavior....
The code should check

System Settings

Example:

  • HVM: hvm 2.0.22
  • Bend: bend-lang 0.2.37-alpha.1

Additional context

No response

@developedby developedby added bug Something isn't working compilation Compilation of terms and functions to HVM labels Sep 30, 2024
@developedby
Copy link
Member

Likely missing a rename of imports somewhere, I'll have a look.

@NoamDev
Copy link
Author

NoamDev commented Oct 6, 2024

@developedby did you take a look? 😅
sorry, if it's just not you prority, I just thought you may have forgotten

@developedby
Copy link
Member

Sorry, I did forget since I was focused on something else. The issue was actually not that hard, we just store the name of the types redundantly and were only updating one of the places.

@NoamDev
Copy link
Author

NoamDev commented Oct 7, 2024

@developedby Now this doesn't work...

** a.bend **

type MyType:
  A {data: u24}
  B {data: u24}

Foo: MyType -> MyType

(Foo (MyType/A a)) = (MyType/A a)
(Foo (MyType/B b)) = (MyType/B b)

** main.bend**

from a import *
main = "hello world"
> bend check main.bend
Errors:
In a :
In definition 'a/Foo':
  Unbound constructor 'MyType/A' in pattern matching rule.
  Unbound constructor 'MyType/B' in pattern matching rule.

@developedby
Copy link
Member

Opened a new issue for that in #724

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compilation Compilation of terms and functions to HVM
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants