lookup.carbon 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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: %x.var: ref %empty_tuple.type = var x
  33. // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var
  34. // CHECK:STDOUT: %.loc12_16.1: %empty_tuple.type = tuple_literal ()
  35. // CHECK:STDOUT: %.loc12_16.2: init %empty_tuple.type = tuple_init () to %x.var [template = constants.%empty_tuple]
  36. // CHECK:STDOUT: %.loc12_17: init %empty_tuple.type = converted %.loc12_16.1, %.loc12_16.2 [template = constants.%empty_tuple]
  37. // CHECK:STDOUT: assign %x.var, %.loc12_17
  38. // CHECK:STDOUT: %x.ref: ref %empty_tuple.type = name_ref x, %x
  39. // CHECK:STDOUT: return
  40. // CHECK:STDOUT: }
  41. // CHECK:STDOUT: