Remove duplicate check for exporting a specific class (#7541)

The check for a specific in `TryMapClassType` is unnecessary;
immediately after it calls `ExportClassToCpp`, which has the same check.
The latter also has a `context.TODO`, which provides a clearer error.

Also improved the `LocId` in `ExportClassToCpp` to use the location of
the first decl rather than the empty location of the class type. This is
the same fix as
https://github.com/carbon-language/carbon-lang/pull/7533, just applied a
little more broadly. This makes the `context.TODO` above point at the
class rather than the start of the source file.
This commit is contained in:
Nicholas Bishop
2026-07-21 18:35:20 +00:00
committed by GitHub
parent d234de41e7
commit 2e61685658
6 changed files with 27 additions and 22 deletions
@@ -74,10 +74,14 @@ import Cpp library "int_param.h";
// This doesn't have a direct type mapping in `getIntTypeForBitwidth`.
fn F(x: i512) {
// CHECK:STDERR: fail_large_int.carbon:[[@LINE+4]]:11: error: call argument of type `i512` is not supported [CppCallArgTypeNotSupported]
// CHECK:STDERR: fail_large_int.carbon:[[@LINE+8]]:11: error: call argument of type `i512` is not supported [CppCallArgTypeNotSupported]
// CHECK:STDERR: Cpp.foo(x);
// CHECK:STDERR: ^
// CHECK:STDERR:
// CHECK:STDERR: min_prelude/parts/int.carbon:10:1: error: semantics TODO: `interop with specific class` [SemanticsTodo]
// CHECK:STDERR: class Int(N: IntLiteral) {
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
// CHECK:STDERR:
Cpp.foo(x);
}