mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-21 22:06:39 +00: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:
1 parent
99f910f179
commit
4ca08b136d
18 files changed
+846
-5
No files matched your search
@@ -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