simple.carbon 1.7 KB

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