mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +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
+20
-20
@@ -15,13 +15,13 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
class A {
|
||||
class StaticMembers {
|
||||
fn F() {}
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void G() {
|
||||
Carbon::A::F();
|
||||
void CallStaticMember() {
|
||||
Carbon::StaticMembers::F();
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -30,16 +30,16 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
class A {
|
||||
class B {
|
||||
class C {
|
||||
class OuterA {
|
||||
class InnerB {
|
||||
class NestedC {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void G() {
|
||||
Carbon::A::B::C *p = nullptr;
|
||||
void TestNested() {
|
||||
Carbon::OuterA::InnerB::NestedC *nested_p = nullptr;
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -48,10 +48,10 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
class A;
|
||||
class IncompleteA;
|
||||
|
||||
inline Cpp '''
|
||||
Carbon::A *p = nullptr;
|
||||
Carbon::IncompleteA *incomplete_p = nullptr;
|
||||
''';
|
||||
|
||||
// --- fail_incomplete_concrete.carbon
|
||||
@@ -60,20 +60,20 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+4]]:1: error: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class A;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: class IncompleteConcreteA;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
class A;
|
||||
class IncompleteConcreteA;
|
||||
|
||||
inline Cpp '''
|
||||
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+7]]:11: error: variable has incomplete type 'Carbon::A' [CppInteropParseError]
|
||||
// CHECK:STDERR: 19 | Carbon::A a;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE-6]]:8: note: forward declaration of 'Carbon::A' [CppInteropParseNote]
|
||||
// CHECK:STDERR: 9 | class A;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+7]]:29: error: variable has incomplete type 'Carbon::IncompleteConcreteA' [CppInteropParseError]
|
||||
// CHECK:STDERR: 19 | Carbon::IncompleteConcreteA incomplete_concrete_a;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE-6]]:26: note: forward declaration of 'Carbon::IncompleteConcreteA' [CppInteropParseNote]
|
||||
// CHECK:STDERR: 9 | class IncompleteConcreteA;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
Carbon::A a;
|
||||
Carbon::IncompleteConcreteA incomplete_concrete_a;
|
||||
''';
|
||||
|
||||
// --- fail_todo_monomorphization_failure.carbon
|
||||
|
||||
Reference in New Issue
Block a user