basic.carbon 2.9 KB

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