declaration.carbon 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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/impl/declaration.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/declaration.carbon
  10. interface I {}
  11. impl i32 as I;
  12. impl i32 as I {}
  13. // CHECK:STDOUT: --- declaration.carbon
  14. // CHECK:STDOUT:
  15. // CHECK:STDOUT: constants {
  16. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  17. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  18. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  19. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  20. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness () [concrete]
  21. // CHECK:STDOUT: }
  22. // CHECK:STDOUT:
  23. // CHECK:STDOUT: imports {
  24. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  25. // CHECK:STDOUT: .Int = %Core.Int
  26. // CHECK:STDOUT: import Core//prelude
  27. // CHECK:STDOUT: import Core//prelude/...
  28. // CHECK:STDOUT: }
  29. // CHECK:STDOUT: }
  30. // CHECK:STDOUT:
  31. // CHECK:STDOUT: file {
  32. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  33. // CHECK:STDOUT: .Core = imports.%Core
  34. // CHECK:STDOUT: .I = %I.decl
  35. // CHECK:STDOUT: }
  36. // CHECK:STDOUT: %Core.import = import Core
  37. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  38. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  39. // CHECK:STDOUT: %int_32.loc13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  40. // CHECK:STDOUT: %i32.loc13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  41. // CHECK:STDOUT: %I.ref.loc13: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  42. // CHECK:STDOUT: }
  43. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness () [concrete = constants.%impl_witness]
  44. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  45. // CHECK:STDOUT: %int_32.loc15: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  46. // CHECK:STDOUT: %i32.loc15: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  47. // CHECK:STDOUT: %I.ref.loc15: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  48. // CHECK:STDOUT: }
  49. // CHECK:STDOUT: }
  50. // CHECK:STDOUT:
  51. // CHECK:STDOUT: interface @I {
  52. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  53. // CHECK:STDOUT:
  54. // CHECK:STDOUT: !members:
  55. // CHECK:STDOUT: .Self = %Self
  56. // CHECK:STDOUT: witness = ()
  57. // CHECK:STDOUT: }
  58. // CHECK:STDOUT:
  59. // CHECK:STDOUT: impl @impl: %i32.loc13 as %I.ref.loc13 {
  60. // CHECK:STDOUT: !members:
  61. // CHECK:STDOUT: witness = file.%impl_witness
  62. // CHECK:STDOUT: }
  63. // CHECK:STDOUT: