mirror of
https://github.com/apple/pkl.git
synced 2026-01-13 15:13:38 +01:00
[feat] module self type allow submodule definition inline
#111
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @othompson2 on GitHub (Mar 10, 2024).
I am trying to define and type a variable using the
moduleself type, however when I attempt to use it I encounter an error. The error suggests it is trying to match to the module type so the self type is working, however its not able to implicitly map theDynamictype to it, this can be resolved by explicitly typing it.I feel like the expected behaviour would be that they do the same thing, however it appears the
modulekeyword currently only supports importing another file rather than defining the sub-module in place. In most circumstances would be fine to switch to the other syntax, but I am trying to define theexamplevariable in a module and then extend it before amending it - so I need to self-type for it to work.Error
When I try to use variable
examplein a module which amendsBird.pklI get the following error:
However if I update the
examplevariable with an explicit self reference the error goes away and it functions as expected.outputs:
@bioball commented on GitHub (Mar 14, 2024):
Thanks! Looks like default value for the
moduletype does not work.