elm-optimize-level-2 icon indicating copy to clipboard operation
elm-optimize-level-2 copied to clipboard

Error: expected number of arguments=256 but got 0 in /dist/transforms/patterns.js:24:31

Open tad-lispy opened this issue 2 years ago • 5 comments

It looks similar to #52 but I thought it's better to open a separate issue. Here's the whole output:

Error: something went wrong, expected number of arguments=256 but got 0 for step
    at Object.exports.matchWrappedInvocation (/home/tad/Projects/software-garden/client-dashboard/node_modules/elm-optimize-level-2/dist/transforms/patterns.js:24:31)
    at collectFunctions (/home/tad/Projects/software-garden/client-dashboard/node_modules/elm-optimize-level-2/dist/transforms/passUnwrappedFunctions.js:19:43)
    at visitNodes (/home/tad/Projects/software-garden/client-dashboard/node_modules/typescript/lib/typescript.js:74866:48)
    at Object.visitEachChild (/home/tad/Projects/software-garden/client-dashboard/node_modules/typescript/lib/typescript.js:75096:156)
    at collectFunctions (/home/tad/Projects/software-garden/client-dashboard/node_modules/elm-optimize-level-2/dist/transforms/passUnwrappedFunctions.js:58:41)
    at visitNode (/home/tad/Projects/software-garden/client-dashboard/node_modules/typescript/lib/typescript.js:74815:23)
    at Object.visitEachChild (/home/tad/Projects/software-garden/client-dashboard/node_modules/typescript/lib/typescript.js:75168:46)
    at collectFunctions (/home/tad/Projects/software-garden/client-dashboard/node_modules/elm-optimize-level-2/dist/transforms/passUnwrappedFunctions.js:58:41)
    at visitNodes (/home/tad/Projects/software-garden/client-dashboard/node_modules/typescript/lib/typescript.js:74866:48)
    at Object.visitEachChild (/home/tad/Projects/software-garden/client-dashboard/node_modules/typescript/lib/typescript.js:75146:45)

We are using Elm Optimize Level 2 as part of Elm Pages. The problem appeared today after merging a branch in our project. We can still build a previous version, so it must be something in our code that triggers the error.

I'll go commit by commit and try to isolate the problem.

tad-lispy avatar Mar 29 '22 10:03 tad-lispy

@SamRPhillips and I found that the bug is triggered by using SHA256 or any other module from https://github.com/folkertdev/elm-sha2.

We prepared a minimal reproducible example here https://gitlab.com/software-garden/elm-optimize-level-2-sha-bug.

Just guessing, but it seems like the digits at the end of module name trigger it.

tad-lispy avatar Mar 29 '22 14:03 tad-lispy

I believe this will be fixed by #91.

lydell avatar Mar 29 '22 16:03 lydell

Thanks @lydell. Good to know it's already on the workbench.

tad-lispy avatar Mar 29 '22 17:03 tad-lispy

I confirm that #91 should fix the issue. The description of the problem very much fit what I have found to be the issue.

jfmengels avatar Mar 29 '22 20:03 jfmengels

This bug has been fixed. This issue should therefore be closed.

jfmengels avatar Jan 08 '23 09:01 jfmengels