mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-25 04:52:37 +00:00
Namespaces are copied, which means also adding their name to the underlying instruction. It happened not to be done previously; the name was only in name lookup. Since the only import supported right now is the default import, functionality is limited; in the future I'll need to deal with namespace vs package conflicts. Tests of namespace imports are under "namespace" -- I figured this would be best for scaling as more instructions get support. This also improves some debugging-related output that I was trying to use while trying to build the support. --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
85 lines
2.4 KiB
Plaintext
85 lines
2.4 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: %.loc11: type = struct_type {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace package, {.A = %A.decl.loc7, .X = %X.decl, .Y = %Y.decl}
|
|
// CHECK:STDOUT: %A.decl.loc7 = class_decl @A.1, ()
|
|
// CHECK:STDOUT: %A: type = class_type @A.1
|
|
// CHECK:STDOUT: %X.decl = class_decl @X, ()
|
|
// CHECK:STDOUT: %X: type = class_type @X
|
|
// CHECK:STDOUT: %A.decl.loc15 = class_decl @A.1, ()
|
|
// CHECK:STDOUT: %Y.decl = class_decl @Y, ()
|
|
// CHECK:STDOUT: %Y: type = class_type @Y
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @A.1 {
|
|
// CHECK:STDOUT: %B.decl = class_decl @B.2, ()
|
|
// CHECK:STDOUT: %B: type = class_type @B.2
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .B = %B.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @X {
|
|
// CHECK:STDOUT: %A.decl = class_decl @A.2, ()
|
|
// CHECK:STDOUT: %A: type = class_type @A.2
|
|
// CHECK:STDOUT: %B.decl = class_decl @B.1, ()
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .A = %A.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @A.2 {
|
|
// CHECK:STDOUT: %B.decl = class_decl @B.1, ()
|
|
// CHECK:STDOUT: %B: type = class_type @B.1
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .B = %B.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @B.1 {
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @B.2;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @Y {
|
|
// CHECK:STDOUT: %.decl = class_decl @.1, ()
|
|
// CHECK:STDOUT: %.loc21: type = class_type @.1
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @.1 {
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|