import_forward_decl.carbon 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  6. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  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/class/import_forward_decl.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/import_forward_decl.carbon
  13. // --- a.carbon
  14. library "[[@TEST_NAME]]";
  15. class ForwardDecl;
  16. // --- a.impl.carbon
  17. impl library "[[@TEST_NAME]]";
  18. class ForwardDecl {
  19. }
  20. // CHECK:STDOUT: --- a.carbon
  21. // CHECK:STDOUT:
  22. // CHECK:STDOUT: constants {
  23. // CHECK:STDOUT: %ForwardDecl: type = class_type @ForwardDecl [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: import Core//prelude/...
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT:
  33. // CHECK:STDOUT: file {
  34. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  35. // CHECK:STDOUT: .Core = imports.%Core
  36. // CHECK:STDOUT: .ForwardDecl = %ForwardDecl.decl
  37. // CHECK:STDOUT: }
  38. // CHECK:STDOUT: %Core.import = import Core
  39. // CHECK:STDOUT: %ForwardDecl.decl: type = class_decl @ForwardDecl [concrete = constants.%ForwardDecl] {} {}
  40. // CHECK:STDOUT: }
  41. // CHECK:STDOUT:
  42. // CHECK:STDOUT: class @ForwardDecl;
  43. // CHECK:STDOUT:
  44. // CHECK:STDOUT: --- a.impl.carbon
  45. // CHECK:STDOUT:
  46. // CHECK:STDOUT: constants {
  47. // CHECK:STDOUT: %ForwardDecl: type = class_type @ForwardDecl [concrete]
  48. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  49. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  50. // CHECK:STDOUT: }
  51. // CHECK:STDOUT:
  52. // CHECK:STDOUT: imports {
  53. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  54. // CHECK:STDOUT: import Core//prelude
  55. // CHECK:STDOUT: import Core//prelude/...
  56. // CHECK:STDOUT: }
  57. // CHECK:STDOUT: }
  58. // CHECK:STDOUT:
  59. // CHECK:STDOUT: file {
  60. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  61. // CHECK:STDOUT: .ForwardDecl = %ForwardDecl.decl
  62. // CHECK:STDOUT: .Core = imports.%Core
  63. // CHECK:STDOUT: }
  64. // CHECK:STDOUT: %default.import.loc2_17.1 = import <none>
  65. // CHECK:STDOUT: %default.import.loc2_17.2 = import <none>
  66. // CHECK:STDOUT: %Core.import = import Core
  67. // CHECK:STDOUT: %ForwardDecl.decl: type = class_decl @ForwardDecl [concrete = constants.%ForwardDecl] {} {}
  68. // CHECK:STDOUT: }
  69. // CHECK:STDOUT:
  70. // CHECK:STDOUT: class @ForwardDecl {
  71. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  72. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  73. // CHECK:STDOUT: complete_type_witness = %complete_type
  74. // CHECK:STDOUT:
  75. // CHECK:STDOUT: !members:
  76. // CHECK:STDOUT: .Self = constants.%ForwardDecl
  77. // CHECK:STDOUT: }
  78. // CHECK:STDOUT: