local.carbon 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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/alias/no_prelude/local.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/local.carbon
  10. fn F() -> () {
  11. var a: () = ();
  12. alias b = a;
  13. return b;
  14. }
  15. // CHECK:STDOUT: --- local.carbon
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: constants {
  18. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  19. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  20. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  21. // CHECK:STDOUT: %tuple: %.1 = tuple_value () [template]
  22. // CHECK:STDOUT: }
  23. // CHECK:STDOUT:
  24. // CHECK:STDOUT: file {
  25. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  26. // CHECK:STDOUT: .F = %F.decl
  27. // CHECK:STDOUT: }
  28. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  29. // CHECK:STDOUT: %return.patt: %.1 = return_slot_pattern
  30. // CHECK:STDOUT: %return.param_patt: %.1 = out_param_pattern %return.patt, runtime_param0
  31. // CHECK:STDOUT: } {
  32. // CHECK:STDOUT: %.loc11_12.1: %.1 = tuple_literal ()
  33. // CHECK:STDOUT: %.loc11_12.2: type = converted %.loc11_12.1, constants.%.1 [template = constants.%.1]
  34. // CHECK:STDOUT: %return.param: ref %.1 = out_param runtime_param0
  35. // CHECK:STDOUT: %return: ref %.1 = return_slot %return.param
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT: }
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: fn @F() -> %.1 {
  40. // CHECK:STDOUT: !entry:
  41. // CHECK:STDOUT: %.loc12_11.1: %.1 = tuple_literal ()
  42. // CHECK:STDOUT: %.loc12_11.2: type = converted %.loc12_11.1, constants.%.1 [template = constants.%.1]
  43. // CHECK:STDOUT: %a.var: ref %.1 = var a
  44. // CHECK:STDOUT: %a: ref %.1 = bind_name a, %a.var
  45. // CHECK:STDOUT: %.loc12_16.1: %.1 = tuple_literal ()
  46. // CHECK:STDOUT: %.loc12_16.2: init %.1 = tuple_init () to %a.var [template = constants.%tuple]
  47. // CHECK:STDOUT: %.loc12_17: init %.1 = converted %.loc12_16.1, %.loc12_16.2 [template = constants.%tuple]
  48. // CHECK:STDOUT: assign %a.var, %.loc12_17
  49. // CHECK:STDOUT: %a.ref: ref %.1 = name_ref a, %a
  50. // CHECK:STDOUT: %b: ref %.1 = bind_alias b, %a
  51. // CHECK:STDOUT: %b.ref: ref %.1 = name_ref b, %b
  52. // CHECK:STDOUT: %tuple: %.1 = tuple_value () [template = constants.%tuple]
  53. // CHECK:STDOUT: %.loc14: %.1 = converted %b.ref, %tuple [template = constants.%tuple]
  54. // CHECK:STDOUT: return %.loc14
  55. // CHECK:STDOUT: }
  56. // CHECK:STDOUT: