mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
When converting an expression to type type, retain the resulting instruction as well as the TypeId. (#4355)
The `TypeId` is lossy, as it represents only the canonical type, and not the specific computation that produced it.
This commit is contained in:
@@ -391,7 +391,8 @@ auto HandleParseNode(Context& context, Parse::AdaptDeclId node_id) -> bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
auto adapted_type_id = ExprAsType(context, node_id, adapted_type_expr_id);
|
||||
auto adapted_type_id =
|
||||
ExprAsType(context, node_id, adapted_type_expr_id).type_id;
|
||||
adapted_type_id = context.AsCompleteType(adapted_type_id, [&] {
|
||||
CARBON_DIAGNOSTIC(IncompleteTypeInAdaptDecl, Error,
|
||||
"adapted type `{0}` is an incomplete type",
|
||||
@@ -467,7 +468,7 @@ static auto DiagnoseBaseIsFinal(Context& context, Parse::NodeId node_id,
|
||||
// Checks that the specified base type is valid.
|
||||
static auto CheckBaseType(Context& context, Parse::NodeId node_id,
|
||||
SemIR::InstId base_expr_id) -> BaseInfo {
|
||||
auto base_type_id = ExprAsType(context, node_id, base_expr_id);
|
||||
auto base_type_id = ExprAsType(context, node_id, base_expr_id).type_id;
|
||||
base_type_id = context.AsCompleteType(base_type_id, [&] {
|
||||
CARBON_DIAGNOSTIC(IncompleteTypeInBaseDecl, Error,
|
||||
"base `{0}` is an incomplete type", SemIR::TypeId);
|
||||
|
||||
Reference in New Issue
Block a user