nested.carbon 2.8 KB

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