decl.carbon 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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/min_prelude/destroy.carbon
  6. // EXTRA-ARGS: --custom-core
  7. //
  8. // AUTOUPDATE
  9. // TIP: To test this file alone, run:
  10. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/min_prelude/decl.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/min_prelude/decl.carbon
  13. // --- basic.carbon
  14. fn Main() {
  15. var x: ();
  16. }
  17. // CHECK:STDOUT: --- basic.carbon
  18. // CHECK:STDOUT:
  19. // CHECK:STDOUT: constants {
  20. // CHECK:STDOUT: %Main.type: type = fn_type @Main [concrete]
  21. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  22. // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete]
  23. // CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete]
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT:
  26. // CHECK:STDOUT: imports {
  27. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  28. // CHECK:STDOUT: import Core//prelude
  29. // CHECK:STDOUT: }
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT:
  32. // CHECK:STDOUT: file {
  33. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  34. // CHECK:STDOUT: .Core = imports.%Core
  35. // CHECK:STDOUT: .Main = %Main.decl
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT: %Core.import = import Core
  38. // CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [concrete = constants.%Main] {} {}
  39. // CHECK:STDOUT: }
  40. // CHECK:STDOUT:
  41. // CHECK:STDOUT: fn @Main() {
  42. // CHECK:STDOUT: !entry:
  43. // CHECK:STDOUT: name_binding_decl {
  44. // CHECK:STDOUT: %x.patt: %pattern_type = binding_pattern x [concrete]
  45. // CHECK:STDOUT: %.loc3_3: %pattern_type = var_pattern %x.patt [concrete]
  46. // CHECK:STDOUT: }
  47. // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var x
  48. // CHECK:STDOUT: %.loc3_11.1: type = splice_block %.loc3_11.3 [concrete = constants.%empty_tuple.type] {
  49. // CHECK:STDOUT: %.loc3_11.2: %empty_tuple.type = tuple_literal ()
  50. // CHECK:STDOUT: %.loc3_11.3: type = converted %.loc3_11.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  51. // CHECK:STDOUT: }
  52. // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var
  53. // CHECK:STDOUT: return
  54. // CHECK:STDOUT: }
  55. // CHECK:STDOUT:
  56. // CHECK:STDOUT: --- include_files/destroy.carbon
  57. // CHECK:STDOUT:
  58. // CHECK:STDOUT: file {
  59. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {}
  60. // CHECK:STDOUT: }
  61. // CHECK:STDOUT: