Skip to content

foreign_impl with function application not being fully reduced #3790

Description

@ear7h

Steps to Reproduce

Sorry again for not minimizing this, but I have the following function which generates scheme code given a type (specifically Struct types), ie. Type -> String:

https://github.com/ear7h/idris-webgpu/blob/96f45a0878c818cc30421c9f4b0476f0420564dc/src/Utils/CTypes.idr#L88-L145

It works on most inputs, but in combination with an data FTypeArray it seems to break down. Here's an example of a call which gives an error:

https://github.com/ear7h/idris-webgpu/blob/96f45a0878c818cc30421c9f4b0476f0420564dc/src/Graphics/GLFW/Sys.idr#L202

Expected Behavior

The function fully reduces to a string.

Observed Behavior

I modified the error message to show that the reduction leaves %NApp $resolved185 [2 closures]

rlwrap idris2 --repl idris-webgpu.ipkg
3/5: Building Graphics.GLFW.Sys (src/Graphics/GLFW/Sys.idr)
Error: %foreign calling convention must evaluate to a String (%NApp $resolved185 [2 closures])

Graphics.GLFW.Sys:202:50--202:89
 198 | 
 199 | -- struct here!!
 200 | %foreign ""
 201 | prim__allocStructGLFWgamepadstate : allocStructPrimType GLFWgamepadstate
 202 | %foreign_impl prim__allocStructGLFWgamepadstate (allocStructPrimCodegen GLFWgamepadstate)
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions