mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 07:24:42 +01:00
Use the correct type for Self in generic classes and generic interfaces (#4087)
In a `class C(T:! type)`, the type `Self` should be `C(T)`, not merely `C`. Similarly, in an `interface I(T:! type)`, the type of self should be `I(T)`, not merely `I`.
This commit is contained in:
@@ -260,8 +260,8 @@ static auto BuildClassDecl(Context& context, Parse::AnyClassDeclId node_id,
|
||||
// declaration.
|
||||
auto& class_info = context.classes().Get(class_decl.class_id);
|
||||
if (class_info.is_generic()) {
|
||||
// TODO: Build generic arguments representing the parameters.
|
||||
auto instance_id = SemIR::GenericInstanceId::Invalid;
|
||||
auto instance_id =
|
||||
MakeGenericSelfInstance(context, class_info.generic_id);
|
||||
class_info.self_type_id = context.GetTypeIdForTypeConstant(
|
||||
TryEvalInst(context, SemIR::InstId::Invalid,
|
||||
SemIR::ClassType{.type_id = SemIR::TypeId::TypeType,
|
||||
|
||||
Reference in New Issue
Block a user