Skip to content

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

Open
@bhansconnect

Description

@bhansconnect

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    code genGenerating machine code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions