I found the thing causing the error in alias analysis in my JWT PR. Calling Task.mapErr
twice seems to be the issue.
verify = \{algorithm, secret, token} ->
PlatformTasks.jwtVerify {algo: algoToU8 algorithm, secret, token}
|> Task.mapErr \err -> JwtErr (mapErrFromHost err)
verify = \{algorithm, secret, token} ->
PlatformTasks.jwtVerify {algo: algoToU8 algorithm, secret, token}
|> Task.mapErr mapErrFromHost
|> Task.mapErr JwtErr
...huh
thread 'main' panicked at crates/compiler/gen_llvm/src/llvm/build.rs:5770:19:
Error in alias analysis: error in module ModName("UserApp"), function definition FuncName("%\x00\x00\x00\x0c\x00\x00\x00w\x08\xf21\x00na\xb2"):
expected type '
union { ((heap_cell,), ()), (union { (), (), (), (), (), (), (), (), ((heap_cell,),) },), ((heap_cell,),) }',
found type '
union { (), (), (), (), (), (), (), (), ((heap_cell,),) }'
I mean this stuff is black magic to me... but I thought it may be a clue that helps.
I'm just stoked because I think I can finish cleaning this up and land it!
Very much a guess, but it seems related to the wrapping and unwrapping of lambdas, which I guess is unsurprising: https://github.com/roc-lang/roc/blob/f6c969af293270feb90dfdc8fcc3ffbe18f9b268/crates/compiler/builtins/roc/Task.roc#L179
That's the impl of mapErr
The same kind of code is usually to blame, in my experience
Found another example...
# Test HS383 algorithm
{
secret: "shhh_very_secret",
algorithm: Hs384,
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.joReqPNNkWQ8zQCW3UQnhc_5NMrSZEOQYpk6sDS6Y-o",
}
|> Jwt.verify
|> Task.await assertClaims
|> Task.mapErr! \err -> Hs384TestErr err
# Test HS383 algorithm
{
secret: "shhh_very_secret",
algorithm: Hs384,
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.joReqPNNkWQ8zQCW3UQnhc_5NMrSZEOQYpk6sDS6Y-o",
}
|> Jwt.verify
|> Task.await assertClaims
|> Task.mapErr! Hs384TestErr
Error in alias analysis: error in module ModName("UserApp"), function definition FuncName("\x11\x00\x00\x00\"\x00\x00\x00\xc53#(\xb1\xc0\xf1\x04"):
expected type
'union { ((heap_cell,), ()), (union { (), (union { (), (), (), (), (), (), (), (), ((heap_cell,),) },), () },), (union { (), (union { (), (), (), (), (), (), (), (), ((heap_cell,),) },), () },), ((heap_cell,),) }',
found type
'union { (union { (), (union { (), (), (), (), (), (), (), (), ((heap_cell,),) },), () },), (union { (), (union { (), (), (), (), (), (), (), (), ((heap_cell,),) },), () },), ((heap_cell,),) }'
I wonder if any of these work arounds could fix the sqlite pr
I had the same thought. I was going to have a look tomorrow :grinning:
Last updated: Jul 06 2025 at 12:14 UTC