Repository navigation
A package's interface carries a generic function as source; the importer instantiates it and links its private callees from the bundle (#3401) - #3503
Merged
Conversation
…ter instantiates it and links its private callees from the bundle (#3401)
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.
Part of #3401 (package bundles, order of work step 1, design §4: generics and
comptimetravel as source).Before: a generic function was left out of a tree bundle's interface ("not exported at Level 0 (generic)"), so an importer that named one got "undefined variable".
Now: in a tree bundle the interface carries a free generic function's declaration as source. The importer parses it, checks it and instantiates it as it does from source. A private function of the package that the generic body calls is already printed in the interface (with its private visibility) and is defined in the bundle's object, so the instance links to it.
BundleInterfaceEmit: a free generic function is printed withrender_decl; its fingerprint row is the hash of that text, so any edit to it is an interface change.Parser: an interface declaration with type parameters keeps its body.render: a group around a binary expression no longer prints a second pair of parentheses. Rendered text gained a pair each time it was read back and rendered again (if (w > best)becameif ((w > best))), so the interface's fingerprint differed from the source's.Tests: the fixture package gains
widest[T], which calls the privateclamp_width.ok_generic_function_instantiatedanderr_generic_function_wrong_argumentgive the same outcome against source and against the interface alone, and the interface reproduces the source's fingerprint (package-interface-check).Still out: generic methods (in an
impl) and generic types;comptimefunctions.Battery green;
:release-checksgreen.