move-language / move

Apache License 2.0
2.25k stars 679 forks source link

[loader] "defining module" support #1004

Closed amnn closed 1 year ago

amnn commented 1 year ago

Add a new API to LinkageResolver to translate the fully-qualified name of a struct (including its runtime ID) to the defining ID (the ID of the package in storage that first defined the struct).

Use this API to store the defining ID as well as the runtime ID in the loaded StructType. (Note: This results in a situation where you can load a type from a type tag, get the type tag for that type and have that operation not be the identity, because it has translated the struct's runtime package ID to its defining package ID).

Test Plan

New loader unit tests:

$ cargo nextest -- loader_tests::relink_defining_module