Open adomurad opened 3 weeks ago
The following work for me on macOS
printPdf : { page ? F32 } -> List U8
printPdf = \{ page ? 21.4 } ->
printPdf : { page ? Dec } -> List U8
printPdf = \{ page ? 21.4 } ->
#printPdf : { page ? Dec } -> List U8
printPdf = \{ page ? 21.4dec } ->
#printPdf : { page ? F32 } -> List U8
printPdf = \{ page ? 21.4f32 } ->
I think the issue here is in resolving the types -- lambda set related, so the compiler crashes, but ideally should provide a nice error message.
@adomurad if you provide a type for the default value it seems to be working ok. I'm not sure if that entirely resolves this issue, but just wanted to add this context for future.
We do have many issues related to lambda set bugs -- this could be a nice repro.
When I use F32
:
printPdf : { page ? F32 } -> Str
printPdf = \{ page ? 21.4 } ->
Then I get:
The surgical linker currently has issue #3609 and would fail linking your app.
Please use `--linker=legacy` to avoid the issue for now.
When using the "legacy" linker, it works fine - but this seems like a different issue. I'm testing on linux.
When trying to run this example I get a
panic
from the compiler:Result:
When I uncomment the type annotation
# printPdf : { page ? F32 } -> List U8
(Frac * becomes F32) then I can run the example on Linux using --linker=legacy .I have tried older compiler versions, older basic-cli platforms, and older json packages - all the same.
The example works with ints (e.g.
I32
,Num *
) and withStr
.