mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 14:01:05 +01:00
Import support for generics and specifics (#4179)
Import generics and specifics when they are referenced by imported entities. When importing a generic, we import the symbolic constants required by its eval block, and then rebuild the eval block itself given the list of constants it needs to compute. This is likely a bit less efficient than directly importing the contents of the eval block, but avoids needing to either extend the importer code to be able to import the instructions that can appear in the eval block or extend the evaluator to cope with instructions from a different `SemIR::File`. Importing a symbolic constant is unaffected, and does not yet preserve the associated generic and index within that generic, so uses of a generic from an imported IR still don't pick up values from the specific, but the improved functionality can be seen in the changes to the SemIR in the testcases.
This commit is contained in:
@@ -32,6 +32,7 @@ class SpecificStore::KeyContext : public TranslatingKeyContext<KeyContext> {
|
||||
|
||||
auto SpecificStore::GetOrAdd(GenericId generic_id, InstBlockId args_id)
|
||||
-> SpecificId {
|
||||
CARBON_CHECK(generic_id.is_valid());
|
||||
return lookup_table_
|
||||
.Insert(
|
||||
KeyContext::Key{.generic_id = generic_id, .args_id = args_id},
|
||||
|
||||
Reference in New Issue
Block a user