mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Support for typeof. (#7858)
Implements `typeof(expr)`, as described in #7697. `expr` is treated as an unevaluated operand, and is kept in an `ExprRegion` separate from the enclosing scope. Assisted-by: Claude via Antigravity
This commit is contained in:
@@ -355,10 +355,12 @@ class Stringifier {
|
||||
template <typename InstT>
|
||||
auto StringifyInst(InstId inst_id, InstT inst) -> void {
|
||||
// This doesn't use requires so that more specific overloads are chosen when
|
||||
// provided.
|
||||
static_assert(InstT::Kind.is_type() != InstIsType::Always ||
|
||||
std::same_as<InstT, WhereExpr>,
|
||||
"Types should have a dedicated overload");
|
||||
// provided. Indirect constants can be printed by desugaring.
|
||||
static_assert(
|
||||
InstT::Kind.is_type() != InstIsType::Always ||
|
||||
InstT::Kind.constant_kind() == InstConstantKind::Indirect ||
|
||||
std::same_as<InstT, WhereExpr>,
|
||||
"Types should have a dedicated overload");
|
||||
// TODO: We should have Stringify support for all types where
|
||||
// InstT::Kind.constant_kind() is neither Never nor Indirect.
|
||||
StringifyInstDefault(inst_id, inst);
|
||||
|
||||
Reference in New Issue
Block a user