global_decl.carbon 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/global_decl.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/global_decl.carbon
  14. var x: {.v: ()};
  15. // CHECK:STDOUT: --- global_decl.carbon
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: constants {
  18. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  19. // CHECK:STDOUT: %struct_type.v: type = struct_type {.v: %empty_tuple.type} [concrete]
  20. // CHECK:STDOUT: %pattern_type: type = pattern_type %struct_type.v [concrete]
  21. // CHECK:STDOUT: }
  22. // CHECK:STDOUT:
  23. // CHECK:STDOUT: file {
  24. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  25. // CHECK:STDOUT: .x = %x
  26. // CHECK:STDOUT: }
  27. // CHECK:STDOUT: name_binding_decl {
  28. // CHECK:STDOUT: %x.patt: %pattern_type = binding_pattern x [concrete]
  29. // CHECK:STDOUT: %x.var_patt: %pattern_type = var_pattern %x.patt [concrete]
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT: %x.var: ref %struct_type.v = var %x.var_patt [concrete]
  32. // CHECK:STDOUT: %.loc15_15: type = splice_block %struct_type.v [concrete = constants.%struct_type.v] {
  33. // CHECK:STDOUT: %.loc15_14.1: %empty_tuple.type = tuple_literal ()
  34. // CHECK:STDOUT: %.loc15_14.2: type = converted %.loc15_14.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  35. // CHECK:STDOUT: %struct_type.v: type = struct_type {.v: %empty_tuple.type} [concrete = constants.%struct_type.v]
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT: %x: ref %struct_type.v = bind_name x, %x.var [concrete = %x.var]
  38. // CHECK:STDOUT: }
  39. // CHECK:STDOUT: