empty_struct.carbon 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. fn Echo(a: {}) -> {} {
  7. return a;
  8. }
  9. fn Main() {
  10. Echo({});
  11. }
  12. // CHECK:STDOUT: --- empty_struct.carbon
  13. // CHECK:STDOUT:
  14. // CHECK:STDOUT: constants {
  15. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  16. // CHECK:STDOUT: %.2: type = tuple_type () [template]
  17. // CHECK:STDOUT: %.3: {} = struct_value () [template]
  18. // CHECK:STDOUT: }
  19. // CHECK:STDOUT:
  20. // CHECK:STDOUT: file {
  21. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  22. // CHECK:STDOUT: .Core = %Core
  23. // CHECK:STDOUT: .Echo = %Echo
  24. // CHECK:STDOUT: .Main = %Main
  25. // CHECK:STDOUT: }
  26. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  27. // CHECK:STDOUT: %Echo: <function> = fn_decl @Echo [template] {
  28. // CHECK:STDOUT: %.loc7_13.1: {} = struct_literal ()
  29. // CHECK:STDOUT: %.loc7_13.2: type = converted %.loc7_13.1, constants.%.1 [template = constants.%.1]
  30. // CHECK:STDOUT: %a.loc7_9.1: {} = param a
  31. // CHECK:STDOUT: @Echo.%a: {} = bind_name a, %a.loc7_9.1
  32. // CHECK:STDOUT: %.loc7_20.1: {} = struct_literal ()
  33. // CHECK:STDOUT: %.loc7_20.2: type = converted %.loc7_20.1, constants.%.1 [template = constants.%.1]
  34. // CHECK:STDOUT: @Echo.%return: ref {} = var <return slot>
  35. // CHECK:STDOUT: }
  36. // CHECK:STDOUT: %Main: <function> = fn_decl @Main [template] {}
  37. // CHECK:STDOUT: }
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: fn @Echo(%a: {}) -> {} {
  40. // CHECK:STDOUT: !entry:
  41. // CHECK:STDOUT: %a.ref: {} = name_ref a, %a
  42. // CHECK:STDOUT: return %a.ref
  43. // CHECK:STDOUT: }
  44. // CHECK:STDOUT:
  45. // CHECK:STDOUT: fn @Main() {
  46. // CHECK:STDOUT: !entry:
  47. // CHECK:STDOUT: %Echo.ref: <function> = name_ref Echo, file.%Echo [template = file.%Echo]
  48. // CHECK:STDOUT: %.loc12_9.1: {} = struct_literal ()
  49. // CHECK:STDOUT: %.loc12_9.2: {} = struct_value () [template = constants.%.3]
  50. // CHECK:STDOUT: %.loc12_7: {} = converted %.loc12_9.1, %.loc12_9.2 [template = constants.%.3]
  51. // CHECK:STDOUT: %Echo.call: init {} = call %Echo.ref(%.loc12_7)
  52. // CHECK:STDOUT: return
  53. // CHECK:STDOUT: }
  54. // CHECK:STDOUT: