mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 07:24:42 +01:00
Rename and rearrange entities in tests to avoid name reuse (#7656)
Fix a bunch of cases where we use the same external name to mean multiple different things in the same test. We've historically gotten away with this, but under `--share-cpp-ast`, it becomes an error, at least if the entity is either defined in, or used from, C++ code. Assisted-by: Gemini via Antigravity (original change) and Claude Code (suggested edits in review) --------- Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
This commit is contained in:
co-authored by
Chandler Carruth
parent
6eb900dff5
commit
c588eadb57
@@ -29,17 +29,17 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
// CHECK:STDERR: fail_var_unsupported_type.carbon:[[@LINE+4]]:5: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo]
|
||||
// CHECK:STDERR: var x: () = ();
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR: var unsupported_x: () = ();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var x: () = ();
|
||||
var unsupported_x: () = ();
|
||||
|
||||
inline Cpp '''
|
||||
void F() {
|
||||
// CHECK:STDERR: fail_var_unsupported_type.carbon:[[@LINE+4]]:11: error: no member named 'x' in namespace 'Carbon' [CppInteropParseError]
|
||||
// CHECK:STDERR: 17 | Carbon::x;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_var_unsupported_type.carbon:[[@LINE+4]]:11: error: no member named 'unsupported_x' in namespace 'Carbon' [CppInteropParseError]
|
||||
// CHECK:STDERR: 17 | Carbon::unsupported_x;
|
||||
// CHECK:STDERR: | ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
Carbon::x;
|
||||
Carbon::unsupported_x;
|
||||
}
|
||||
''';
|
||||
|
||||
+10
-10
@@ -42,7 +42,7 @@ fn MyF() {
|
||||
// --- unsupported_type.h
|
||||
|
||||
using UnusupportedType = _BitInt(23);
|
||||
UnusupportedType global;
|
||||
UnusupportedType unsupported_global;
|
||||
|
||||
// --- fail_import_unsupported_type.carbon
|
||||
|
||||
@@ -56,17 +56,17 @@ import Cpp library "unsupported_type.h";
|
||||
|
||||
fn MyF() {
|
||||
// CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+11]]:21: note: in `Cpp` name lookup for `UnusupportedType` [InCppNameLookup]
|
||||
// CHECK:STDERR: let unused local: Cpp.UnusupportedType = Cpp.global;
|
||||
// CHECK:STDERR: let unused local: Cpp.UnusupportedType = Cpp.unsupported_global;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+7]]:44: error: semantics TODO: `Unsupported: var type: UnusupportedType` [SemanticsTodo]
|
||||
// CHECK:STDERR: let unused local: Cpp.UnusupportedType = Cpp.global;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+4]]:44: note: in `Cpp` name lookup for `global` [InCppNameLookup]
|
||||
// CHECK:STDERR: let unused local: Cpp.UnusupportedType = Cpp.global;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: let unused local: Cpp.UnusupportedType = Cpp.unsupported_global;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+4]]:44: note: in `Cpp` name lookup for `unsupported_global` [InCppNameLookup]
|
||||
// CHECK:STDERR: let unused local: Cpp.UnusupportedType = Cpp.unsupported_global;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
let unused local: Cpp.UnusupportedType = Cpp.global;
|
||||
let unused local: Cpp.UnusupportedType = Cpp.unsupported_global;
|
||||
}
|
||||
|
||||
// CHECK:STDOUT: --- import_global_scope.carbon
|
||||
@@ -198,7 +198,7 @@ fn MyF() {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .UnusupportedType = <error>
|
||||
// CHECK:STDOUT: .global = <error>
|
||||
// CHECK:STDOUT: .unsupported_global = <error>
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
@@ -219,7 +219,7 @@ fn MyF() {
|
||||
// CHECK:STDOUT: fn @MyF() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref.loc22_44: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %global.ref: <error> = name_ref global, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %unsupported_global.ref: <error> = name_ref unsupported_global, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.1: <error> = splice_block <error> [concrete = <error>] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc22_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %UnusupportedType.ref: <error> = name_ref UnusupportedType, <error> [concrete = <error>]
|
||||
|
||||
Reference in New Issue
Block a user