basic.carbon 3.2 KB

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