Lower FacetType to TypeType to match FacetValue lowering (#7734)

SemIR::FacetValue lowers to context.GetTypeAsValue(), which produces a
constant of LLVM type %type (context.GetTypeType()). However,
SemIR::FacetType previously fell back to an anonymous empty struct {},
causing an argument type mismatch assertion failure when passing a
FacetValue to a function expecting a FacetType parameter.

Identified by @danakj in #7731

Assisted-by: Antigravity with Gemini
This commit is contained in:
David Blaikie
2026-09-08 18:32:34 +00:00
committed by GitHub
parent e5f30d1738
commit 3339dd85de
2 changed files with 45 additions and 11 deletions
+8 -6
View File
@@ -802,7 +802,9 @@ static auto BuildTypeForInst(FileContext& context, SemIR::TupleType inst)
return BuildStructType(context, subtypes, layouts);
}
static auto BuildTypeForInst(FileContext& context, SemIR::TypeType /*inst*/)
template <typename InstT>
requires(InstT::Kind.template IsAnyOf<SemIR::FacetType, SemIR::TypeType>())
static auto BuildTypeForInst(FileContext& context, InstT /*inst*/)
-> LoweredTypes {
return {context.GetTypeType(), nullptr};
}
@@ -821,11 +823,11 @@ template <typename InstT>
requires(InstT::Kind.template IsAnyOf<
SemIR::AssociatedEntityType, SemIR::AutoType, SemIR::BoundMethodType,
SemIR::CharLiteralType, SemIR::CppOverloadSetType,
SemIR::CppTemplateNameType, SemIR::FacetType,
SemIR::FloatLiteralType, SemIR::FunctionType,
SemIR::FunctionTypeWithSelfType, SemIR::GenericClassType,
SemIR::GenericInterfaceType, SemIR::GenericNamedConstraintType,
SemIR::InstType, SemIR::IntLiteralType, SemIR::NamespaceType,
SemIR::CppTemplateNameType, SemIR::FloatLiteralType,
SemIR::FunctionType, SemIR::FunctionTypeWithSelfType,
SemIR::GenericClassType, SemIR::GenericInterfaceType,
SemIR::GenericNamedConstraintType, SemIR::InstType,
SemIR::IntLiteralType, SemIR::NamespaceType,
SemIR::RequireSpecificDefinitionType, SemIR::SpecificFunctionType,
SemIR::UnboundElementType, SemIR::WhereExpr, SemIR::WitnessType>())
static auto BuildTypeForInst(FileContext& context, InstT /*inst*/)