Compile a type that came from another module - #885
Merged
Conversation
A call could cross a boundary and a type could not, so a program that imported a record, a choice, an effect or a handler was refused however plain the call using it was. A type crosses the same way a function does, and what matters is that it comes out as what the module that declared it built. Two layouts for one record would make a value of it fit neither, so each module's tables gain the names its `use` lines asked for rather than a copy of the shape. By name and only for what was asked for, so two modules that both declare a `Point` keep their own. The checker carries an imported type by module and name rather than by definition, for the reason a `DefId` cannot cross at all, and the lowering had no arm for that shape. It has one now, and the name is enough because the borrowing above put the right layout under it. Part of #877.
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.
Follow-up to #882. A call could cross a module boundary and a type could not, so a program that imported a record, a choice, an effect or a handler was refused however plain the call using it was.
A type crosses the same way a function does, and the thing that matters is that it comes out as what the module that declared it built. Two layouts for one record would make a value of it fit neither, so each module's tables gain the names its
uselines asked for rather than a copy of the shape. By name and only for what was asked for, so two modules that both declare aPointkeep their own.The checker carries an imported type by module and name rather than by definition, for the same reason a
DefIdcan't cross at all, and the lowering had no arm for that shape. It has one now, and the name is enough because the borrowing above put the right layout under it.The agreement test reads a field of a record the other module built and matches on a variant of a choice the other module declared, which is what would break if the two sides disagreed on the layout.
Part of #877.
Written with AI assistance.