fail_namespace_conflict.carbon 1.4 KB

12345678910111213141516171819202122232425262728293031
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/convert.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/fail_namespace_conflict.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/fail_namespace_conflict.carbon
  12. namespace A;
  13. // CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE+7]]:5: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate]
  14. // CHECK:STDERR: var A: ();
  15. // CHECK:STDERR: ^
  16. // CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE-5]]:1: note: name is previously declared here [NameDeclPrevious]
  17. // CHECK:STDERR: namespace A;
  18. // CHECK:STDERR: ^~~~~~~~~~~~
  19. // CHECK:STDERR:
  20. var A: ();
  21. // CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE+7]]:5: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate]
  22. // CHECK:STDERR: var A: () = ();
  23. // CHECK:STDERR: ^
  24. // CHECK:STDERR: fail_namespace_conflict.carbon:[[@LINE-14]]:1: note: name is previously declared here [NameDeclPrevious]
  25. // CHECK:STDERR: namespace A;
  26. // CHECK:STDERR: ^~~~~~~~~~~~
  27. // CHECK:STDERR:
  28. var A: () = ();