move-language / move

Apache License 2.0
2.24k stars 677 forks source link

[move-binary-format] Support changing of signatures for private entry functions #1012

Closed tzakian closed 1 year ago

tzakian commented 1 year ago

Adds a new flag check_private_entry_linking that when true checks the private entry function signatures cannot change. E.g.,

If we had

entry fun fn() { }

and

entry fun fn(_x: u64) { }

These would be compatible if check_private_entry_linking was set to false but ruled incompatible if check_private_entry_linking was set to true.

tzakian commented 1 year ago

Updated this, and added a bunch of new tests testing pretty much every combo I could think of around entry functions especially private (and friend) entry function transitions.

Wound up making some changes to normalization as well since it was splitting functions into exposed and non-exposed based on both visibility and whether or not it was an entry function which was causing all sorts of nastiness (e.g., entry fun that then got changed to fun no longer is in the exposed_functions etc.). So I just wound up putting them all together into one table which made things nicer.

Also added the check that you wanted, and also found some other places while writing the tests that I fixed.