experiment: migration functions trigger use-before-define errors
I had a hunch that using a migration function would allow you to apply a stable function before it is properly defined. Turns out to be true...
This is a simple variation of the existing, simpler test dropping-stable-functions that, in a twist, uses the migration function to call a stable function that references an earlier stable variable (uninitialized) before it has been defined, leading to a crash.
Good catch. Thanks for identifying. I fixed in meantime: 8ceede90205cdc4366437aa9a0a4b17c113cf0a9 I guess persistent function calls can be disallowed during migration.
Improved version that allows safe persistent function calls during migration: E.g. accessing persistent class methods of object-oriented data structures during migration. https://github.com/dfinity/motoko/pull/5462