nested.carbon 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/nested.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/nested.carbon
  10. namespace Foo;
  11. namespace Foo.Bar;
  12. fn Foo.Bar.Wiz() {
  13. }
  14. fn Foo.Bar.Baz() {
  15. Foo.Bar.Wiz();
  16. }
  17. // CHECK:STDOUT: --- nested.carbon
  18. // CHECK:STDOUT:
  19. // CHECK:STDOUT: constants {
  20. // CHECK:STDOUT: %Wiz.type: type = fn_type @Wiz [concrete]
  21. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  22. // CHECK:STDOUT: %Wiz: %Wiz.type = struct_value () [concrete]
  23. // CHECK:STDOUT: %Baz.type: type = fn_type @Baz [concrete]
  24. // CHECK:STDOUT: %Baz: %Baz.type = struct_value () [concrete]
  25. // CHECK:STDOUT: }
  26. // CHECK:STDOUT:
  27. // CHECK:STDOUT: imports {
  28. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  29. // CHECK:STDOUT: import Core//prelude
  30. // CHECK:STDOUT: import Core//prelude/...
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT:
  34. // CHECK:STDOUT: file {
  35. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  36. // CHECK:STDOUT: .Core = imports.%Core
  37. // CHECK:STDOUT: .Foo = %Foo
  38. // CHECK:STDOUT: }
  39. // CHECK:STDOUT: %Core.import = import Core
  40. // CHECK:STDOUT: %Foo: <namespace> = namespace [concrete] {
  41. // CHECK:STDOUT: .Bar = %Bar
  42. // CHECK:STDOUT: .Foo = <poisoned>
  43. // CHECK:STDOUT: }
  44. // CHECK:STDOUT: %Bar: <namespace> = namespace [concrete] {
  45. // CHECK:STDOUT: .Wiz = %Wiz.decl
  46. // CHECK:STDOUT: .Baz = %Baz.decl
  47. // CHECK:STDOUT: .Foo = <poisoned>
  48. // CHECK:STDOUT: }
  49. // CHECK:STDOUT: %Wiz.decl: %Wiz.type = fn_decl @Wiz [concrete = constants.%Wiz] {} {}
  50. // CHECK:STDOUT: %Baz.decl: %Baz.type = fn_decl @Baz [concrete = constants.%Baz] {} {}
  51. // CHECK:STDOUT: }
  52. // CHECK:STDOUT:
  53. // CHECK:STDOUT: fn @Wiz() {
  54. // CHECK:STDOUT: !entry:
  55. // CHECK:STDOUT: return
  56. // CHECK:STDOUT: }
  57. // CHECK:STDOUT:
  58. // CHECK:STDOUT: fn @Baz() {
  59. // CHECK:STDOUT: !entry:
  60. // CHECK:STDOUT: %Foo.ref: <namespace> = name_ref Foo, file.%Foo [concrete = file.%Foo]
  61. // CHECK:STDOUT: %Bar.ref: <namespace> = name_ref Bar, file.%Bar [concrete = file.%Bar]
  62. // CHECK:STDOUT: %Wiz.ref: %Wiz.type = name_ref Wiz, file.%Wiz.decl [concrete = constants.%Wiz]
  63. // CHECK:STDOUT: %Wiz.call: init %empty_tuple.type = call %Wiz.ref()
  64. // CHECK:STDOUT: return
  65. // CHECK:STDOUT: }
  66. // CHECK:STDOUT: