lookup.carbon 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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/var/no_prelude/lookup.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/lookup.carbon
  10. fn Main() {
  11. var x: () = ();
  12. x;
  13. }
  14. // CHECK:STDOUT: --- lookup.carbon
  15. // CHECK:STDOUT:
  16. // CHECK:STDOUT: constants {
  17. // CHECK:STDOUT: %Main.type: type = fn_type @Main [template]
  18. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  19. // CHECK:STDOUT: %Main: %Main.type = struct_value () [template]
  20. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
  21. // CHECK:STDOUT: }
  22. // CHECK:STDOUT:
  23. // CHECK:STDOUT: file {
  24. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  25. // CHECK:STDOUT: .Main = %Main.decl
  26. // CHECK:STDOUT: }
  27. // CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [template = constants.%Main] {} {}
  28. // CHECK:STDOUT: }
  29. // CHECK:STDOUT:
  30. // CHECK:STDOUT: fn @Main() {
  31. // CHECK:STDOUT: !entry:
  32. // CHECK:STDOUT: name_binding_decl {
  33. // CHECK:STDOUT: %x.patt: %empty_tuple.type = binding_pattern x
  34. // CHECK:STDOUT: %.loc12_3.1: %empty_tuple.type = var_pattern %x.patt
  35. // CHECK:STDOUT: }
  36. // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var x
  37. // CHECK:STDOUT: %.loc12_16.1: %empty_tuple.type = tuple_literal ()
  38. // CHECK:STDOUT: %.loc12_16.2: init %empty_tuple.type = tuple_init () to %x.var [template = constants.%empty_tuple]
  39. // CHECK:STDOUT: %.loc12_3.2: init %empty_tuple.type = converted %.loc12_16.1, %.loc12_16.2 [template = constants.%empty_tuple]
  40. // CHECK:STDOUT: assign %x.var, %.loc12_3.2
  41. // CHECK:STDOUT: %.loc12_11.1: type = splice_block %.loc12_11.3 [template = constants.%empty_tuple.type] {
  42. // CHECK:STDOUT: %.loc12_11.2: %empty_tuple.type = tuple_literal ()
  43. // CHECK:STDOUT: %.loc12_11.3: type = converted %.loc12_11.2, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
  44. // CHECK:STDOUT: }
  45. // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var
  46. // CHECK:STDOUT: %x.ref: ref %empty_tuple.type = name_ref x, %x
  47. // CHECK:STDOUT: return
  48. // CHECK:STDOUT: }
  49. // CHECK:STDOUT: