decl.carbon 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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/decl.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/decl.carbon
  10. fn Main() {
  11. var x: ();
  12. }
  13. // CHECK:STDOUT: --- decl.carbon
  14. // CHECK:STDOUT:
  15. // CHECK:STDOUT: constants {
  16. // CHECK:STDOUT: %Main.type: type = fn_type @Main [template]
  17. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  18. // CHECK:STDOUT: %Main: %Main.type = struct_value () [template]
  19. // CHECK:STDOUT: }
  20. // CHECK:STDOUT:
  21. // CHECK:STDOUT: file {
  22. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  23. // CHECK:STDOUT: .Main = %Main.decl
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [template = constants.%Main] {} {}
  26. // CHECK:STDOUT: }
  27. // CHECK:STDOUT:
  28. // CHECK:STDOUT: fn @Main() {
  29. // CHECK:STDOUT: !entry:
  30. // CHECK:STDOUT: name_binding_decl {
  31. // CHECK:STDOUT: %x.patt: %empty_tuple.type = binding_pattern x
  32. // CHECK:STDOUT: %.loc12_3: %empty_tuple.type = var_pattern %x.patt
  33. // CHECK:STDOUT: }
  34. // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var x
  35. // CHECK:STDOUT: %.loc12_11.1: type = splice_block %.loc12_11.3 [template = constants.%empty_tuple.type] {
  36. // CHECK:STDOUT: %.loc12_11.2: %empty_tuple.type = tuple_literal ()
  37. // CHECK:STDOUT: %.loc12_11.3: type = converted %.loc12_11.2, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
  38. // CHECK:STDOUT: }
  39. // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var
  40. // CHECK:STDOUT: return
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT: