simple.carbon 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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/none.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/function/declaration/simple.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/simple.carbon
  14. fn F();
  15. fn G() { F(); }
  16. // CHECK:STDOUT: --- simple.carbon
  17. // CHECK:STDOUT:
  18. // CHECK:STDOUT: constants {
  19. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  20. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  21. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  22. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  23. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT:
  26. // CHECK:STDOUT: file {
  27. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  28. // CHECK:STDOUT: .F = %F.decl
  29. // CHECK:STDOUT: .G = %G.decl
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  32. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {}
  33. // CHECK:STDOUT: }
  34. // CHECK:STDOUT:
  35. // CHECK:STDOUT: fn @F();
  36. // CHECK:STDOUT:
  37. // CHECK:STDOUT: fn @G() {
  38. // CHECK:STDOUT: !entry:
  39. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  40. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref()
  41. // CHECK:STDOUT: return
  42. // CHECK:STDOUT: }
  43. // CHECK:STDOUT: