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
@@ -14,13 +14,13 @@
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class C {
|
||||
class PublicClass {
|
||||
static var x: i32 = 123;
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
int F() {
|
||||
return Carbon::C::x;
|
||||
int PublicStatic() {
|
||||
return Carbon::PublicClass::x;
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -28,19 +28,19 @@ int F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class C {
|
||||
class PrivateClass {
|
||||
private static var x: i32 = 123;
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
int F() {
|
||||
// CHECK:STDERR: fail_static_private.carbon:[[@LINE+7]]:21: error: 'x' is a private member of 'Carbon::C' [CppInteropParseError]
|
||||
// CHECK:STDERR: 17 | return Carbon::C::x;
|
||||
// CHECK:STDERR: | ^
|
||||
int PrivateStatic() {
|
||||
// CHECK:STDERR: fail_static_private.carbon:[[@LINE+7]]:32: error: 'x' is a private member of 'Carbon::PrivateClass' [CppInteropParseError]
|
||||
// CHECK:STDERR: 17 | return Carbon::PrivateClass::x;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_static_private.carbon:[[@LINE-8]]:23: note: implicitly declared private here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | private static var x: i32 = 123;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
return Carbon::C::x;
|
||||
return Carbon::PrivateClass::x;
|
||||
}
|
||||
''';
|
||||
|
||||
Reference in New Issue
Block a user