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

Roc does not generate closure calling functions if they are untyped #7165

Open
bhansconnect opened this issue Oct 13, 2024 · 0 comments
Open
Labels
code gen Generating machine code

Comments

@bhansconnect
Copy link
Contributor

modify crates/cli/tests/multiple_exposed/platform/main.roc to this:

platform "multiple_exposed"
    requires {} { exposed1 : I64 -> I64, exposed2 : I64 -> I64, add1 : I64 -> I64, sub1 : I64 -> I64 }
    exposes []
    packages {}
    imports []
    provides [exposedRecord]

# exposedRecord : {
#     func1 : I64 -> I64,
#     func2 : I64 -> I64,
# }
exposedRecord = {
    func1: \a -> exposed1 a |> sub1 |> add1,
    func2: \a -> exposed2 a |> add1 |> sub1,
}

If you run roc build --lib --emit-llvm-ir --optimize crates/cli/tests/multiple_exposed/main.roc,
and open up the generated llvm ir, you can see that no -caller functions are generated.

Uncomment the type definition and run again. Everything generates as expected.


Expected behaviour: The functions are generated whether or not the type is specified.

Bonus: Can we get the functions to generate based on the record field name instead of just an index number

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code gen Generating machine code
Projects
None yet
Development

No branches or pull requests

2 participants