basic.carbon 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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/interface/no_prelude/basic.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/basic.carbon
  13. interface Empty {
  14. }
  15. interface ForwardDeclared;
  16. interface ForwardDeclared {
  17. fn F();
  18. }
  19. // CHECK:STDOUT: --- basic.carbon
  20. // CHECK:STDOUT:
  21. // CHECK:STDOUT: constants {
  22. // CHECK:STDOUT: %Empty.type: type = facet_type <@Empty> [concrete]
  23. // CHECK:STDOUT: %Self.193: %Empty.type = bind_symbolic_name Self, 0 [symbolic]
  24. // CHECK:STDOUT: %ForwardDeclared.type: type = facet_type <@ForwardDeclared> [concrete]
  25. // CHECK:STDOUT: %Self.efa: %ForwardDeclared.type = bind_symbolic_name Self, 0 [symbolic]
  26. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  27. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  28. // CHECK:STDOUT: %ForwardDeclared.assoc_type: type = assoc_entity_type @ForwardDeclared [concrete]
  29. // CHECK:STDOUT: %assoc0: %ForwardDeclared.assoc_type = assoc_entity element0, @ForwardDeclared.%F.decl [concrete]
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT:
  32. // CHECK:STDOUT: file {
  33. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  34. // CHECK:STDOUT: .Empty = %Empty.decl
  35. // CHECK:STDOUT: .ForwardDeclared = %ForwardDeclared.decl.loc17
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT: %Empty.decl: type = interface_decl @Empty [concrete = constants.%Empty.type] {} {}
  38. // CHECK:STDOUT: %ForwardDeclared.decl.loc17: type = interface_decl @ForwardDeclared [concrete = constants.%ForwardDeclared.type] {} {}
  39. // CHECK:STDOUT: %ForwardDeclared.decl.loc19: type = interface_decl @ForwardDeclared [concrete = constants.%ForwardDeclared.type] {} {}
  40. // CHECK:STDOUT: }
  41. // CHECK:STDOUT:
  42. // CHECK:STDOUT: interface @Empty {
  43. // CHECK:STDOUT: %Self: %Empty.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.193]
  44. // CHECK:STDOUT:
  45. // CHECK:STDOUT: !members:
  46. // CHECK:STDOUT: .Self = %Self
  47. // CHECK:STDOUT: witness = ()
  48. // CHECK:STDOUT: }
  49. // CHECK:STDOUT:
  50. // CHECK:STDOUT: interface @ForwardDeclared {
  51. // CHECK:STDOUT: %Self: %ForwardDeclared.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.efa]
  52. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  53. // CHECK:STDOUT: %assoc0: %ForwardDeclared.assoc_type = assoc_entity element0, %F.decl [concrete = constants.%assoc0]
  54. // CHECK:STDOUT:
  55. // CHECK:STDOUT: !members:
  56. // CHECK:STDOUT: .Self = %Self
  57. // CHECK:STDOUT: .F = %assoc0
  58. // CHECK:STDOUT: witness = (%F.decl)
  59. // CHECK:STDOUT: }
  60. // CHECK:STDOUT:
  61. // CHECK:STDOUT: generic fn @F(@ForwardDeclared.%Self: %ForwardDeclared.type) {
  62. // CHECK:STDOUT: fn();
  63. // CHECK:STDOUT: }
  64. // CHECK:STDOUT:
  65. // CHECK:STDOUT: specific @F(constants.%Self.efa) {}
  66. // CHECK:STDOUT: