Fix persistent func typing to compile motoko-core#5484
Merged
luc-blaeser merged 22 commits intoluc/stable-functionsfrom Sep 19, 2025
Merged
Fix persistent func typing to compile motoko-core#5484luc-blaeser merged 22 commits intoluc/stable-functionsfrom
persistent func typing to compile motoko-core#5484luc-blaeser merged 22 commits intoluc/stable-functionsfrom
Conversation
Contributor
Kamirus
commented
Sep 16, 2025
crusso
reviewed
Sep 16, 2025
crusso
reviewed
Sep 16, 2025
| persistent func h() : T { x }; | ||
| h; // TODO: non-eop should still typecheck here | ||
| }; | ||
| // don't allow `func() {}` to typecheck as `persistent() -> ()` for now |
Contributor
There was a problem hiding this comment.
Yep, I think anonymous lambdas can never be persistent in Luc's design
Contributor
Author
There was a problem hiding this comment.
They need a name, I have it in another test
Contributor
There was a problem hiding this comment.
I think even just a name ain't enough. The name needs to be unique in the path (i.e. a declaration in a persistent context).
Contributor
Author
There was a problem hiding this comment.
Contributor
There was a problem hiding this comment.
I think this is the same issue as the B.mo or the C.mo file in here: https://github.com/dfinity/motoko/pull/5354/files#diff-0e9e9083aa4cfa901cd7251a640e3a9b3f95eb13e0b10b34ed5bfeaa6b20ab1c
persistent func typing to compile motoko-core
luc-blaeser
approved these changes
Sep 19, 2025
Contributor
luc-blaeser
left a comment
There was a problem hiding this comment.
Thank you, Kamil. Much appreciated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
persistent functo getmotoko-core(object-oriented branch) to compile (see the successful test run here)persistent functofuncin non-eop setting. This is probably less confusing route. We could revert to the "implicit conversion" way but we would need to add more of these conversions in the compiler where they were missing...