C++ Interop: Add Core.CppCompat.Long32 as a distinct type for Cpp.long when long is 32 bits (#6364)

For now, only support implicit conversions from and to `i32`.

See #6275 for rationale.

Part of #5263.
This commit is contained in:
Boaz Brickner
2025-11-14 23:26:43 +00:00
committed by GitHub
parent e62678e682
commit bc734bb768
7 changed files with 368 additions and 123 deletions
+5
View File
@@ -1112,6 +1112,11 @@ static auto MapBuiltinIntegerType(Context& context, SemIR::LocId loc_id,
return ExprAsType(context, Parse::NodeId::None,
MakeCharTypeLiteral(context, Parse::NodeId::None));
}
if (ast_context.hasSameType(qual_type, ast_context.LongTy) && width == 32) {
return ExprAsType(context, Parse::NodeId::None,
LookupNameInCore(context, Parse::NodeId::None,
{"CppCompat", "Long32"}));
}
return TypeExpr::None;
}