Add CallAction to allow deferring calls (#7682)

Calls with template callee or args can now be deferred via an
InstAction. This allows code like this to check:

```carbon
import Cpp inline '''
template<typename T>
struct C {};
''';

fn F(generic T: type) {
  let unused c: Cpp.C(T) = Cpp.C(T).C();
}
```
This commit is contained in:
Nicholas Bishop
2026-08-28 18:00:58 +00:00
committed by GitHub
parent 0ea8fb2e74
commit f519cccaf2
16 changed files with 742 additions and 537 deletions
+15 -2
View File
@@ -579,6 +579,19 @@ static auto GetConstantValue(EvalContext& eval_context,
return inst_id;
}
static auto GetConstantValue(EvalContext& eval_context,
SemIR::MetaInstBlockId inst_block_id, Phase* phase)
-> SemIR::MetaInstBlockId {
auto inst_ids = eval_context.inst_blocks().Get(inst_block_id);
llvm::SmallVector<SemIR::InstId> new_inst_ids;
for (auto inst_id : inst_ids) {
new_inst_ids.push_back(
GetConstantValue(eval_context, SemIR::MetaInstId{inst_id}, phase));
}
return eval_context.inst_blocks().Add(new_inst_ids);
}
static auto GetConstantValue(EvalContext& eval_context,
SemIR::TypeInstId inst_id, Phase* phase)
-> SemIR::TypeInstId {
@@ -1070,8 +1083,8 @@ template <typename IdT>
requires SemIR::Internal::IsIdKindType<IdT> &&
SameAsOneOf<IdT, SemIR::IdAndKind::NoneType, SemIR::DestInstId,
SemIR::EntityNameId, SemIR::InstBlockId, SemIR::InstId,
SemIR::MetaInstId, SemIR::StructTypeFieldsId,
SemIR::TypeInstId>
SemIR::MetaInstId, SemIR::MetaInstBlockId,
SemIR::StructTypeFieldsId, SemIR::TypeInstId>
static auto ResolveSpecificDeclForArg(EvalContext& /*eval_context*/, IdT /*id*/)
-> void {
// These id types have a GetConstantValue() overload but that overload