Files
carbon-lang/toolchain/check/testdata/class/fail_redeclaration_scope.carbon
T
Jon Ross-Perkins 895e90e791 Start including the prelude for testing. (#3861)
- Adds an empty prelude.carbon file
- Imports that file in any non-Core package file
  - Adds --disable-prelude-import to avoid that
- Adds --exclude-dump-file-prefix to be able to hide files from dumping
- Used to hide core files (we can't do this by package name due to lex
dumps, for example)
- Restructures some tests to not rely on `i32`, particularly `alias`
tests (which rely on a name ref) and tests with no prelude.

I'm adding the framework for switching i32 to calling Int32 in the
prelude, but I'm running into a separate error actually switching over.
So that *mostly* works, but isn't quite ready for prime time. However,
maybe the current state of this PR is still useful to review since it
does a lot of the infrastructure work and adds the %Core everywhere?
2024-04-07 17:11:42 +00:00

95 lines
3.1 KiB
Plaintext

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
class A;
class X {
// OK, a different A.
class A { class B; }
class A.B {}
}
class A { class B; }
class Y {
// CHECK:STDERR: fail_redeclaration_scope.carbon:[[@LINE+3]]:9: ERROR: Name `A` not found.
// CHECK:STDERR: class A.B {}
// CHECK:STDERR: ^
class A.B {}
}
// CHECK:STDOUT: --- fail_redeclaration_scope.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %A.1: type = class_type @A.1 [template]
// CHECK:STDOUT: %X: type = class_type @X [template]
// CHECK:STDOUT: %A.2: type = class_type @A.2 [template]
// CHECK:STDOUT: %B.1: type = class_type @B.1 [template]
// CHECK:STDOUT: %.1: type = struct_type {} [template]
// CHECK:STDOUT: %B.2: type = class_type @B.2 [template]
// CHECK:STDOUT: %Y: type = class_type @Y [template]
// CHECK:STDOUT: %.2: type = class_type @.1 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .Core = %Core
// CHECK:STDOUT: .A = %A.decl.loc7
// CHECK:STDOUT: .X = %X.decl
// CHECK:STDOUT: .Y = %Y.decl
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
// CHECK:STDOUT: %A.decl.loc7: type = class_decl @A.1 [template = constants.%A.1] {}
// CHECK:STDOUT: %X.decl: type = class_decl @X [template = constants.%X] {}
// CHECK:STDOUT: %A.decl.loc15: type = class_decl @A.1 [template = constants.%A.1] {}
// CHECK:STDOUT: %Y.decl: type = class_decl @Y [template = constants.%Y] {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: class @A.1 {
// CHECK:STDOUT: %B.decl: type = class_decl @B.2 [template = constants.%B.2] {}
// CHECK:STDOUT:
// CHECK:STDOUT: !members:
// CHECK:STDOUT: .Self = constants.%A.1
// CHECK:STDOUT: .B = %B.decl
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: class @X {
// CHECK:STDOUT: %A.decl: type = class_decl @A.2 [template = constants.%A.2] {}
// CHECK:STDOUT: %B.decl: type = class_decl @B.1 [template = constants.%B.1] {}
// CHECK:STDOUT:
// CHECK:STDOUT: !members:
// CHECK:STDOUT: .Self = constants.%X
// CHECK:STDOUT: .A = %A.decl
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: class @A.2 {
// CHECK:STDOUT: %B.decl: type = class_decl @B.1 [template = constants.%B.1] {}
// CHECK:STDOUT:
// CHECK:STDOUT: !members:
// CHECK:STDOUT: .Self = constants.%A.2
// CHECK:STDOUT: .B = %B.decl
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: class @B.1 {
// CHECK:STDOUT: !members:
// CHECK:STDOUT: .Self = constants.%B.1
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: class @B.2;
// CHECK:STDOUT:
// CHECK:STDOUT: class @Y {
// CHECK:STDOUT: %.decl: type = class_decl @.1 [template = constants.%.2] {}
// CHECK:STDOUT:
// CHECK:STDOUT: !members:
// CHECK:STDOUT: .Self = constants.%Y
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: class @.1 {
// CHECK:STDOUT: !members:
// CHECK:STDOUT: .Self = constants.%.2
// CHECK:STDOUT: }
// CHECK:STDOUT: