fail_extend_partially_defined_interface.carbon 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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/impl/fail_extend_partially_defined_interface.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon
  13. interface I {
  14. class C {
  15. // CHECK:STDERR: fail_extend_partially_defined_interface.carbon:[[@LINE+7]]:5: error: `extend impl as` incomplete facet type `I` [ExtendImplAsIncomplete]
  16. // CHECK:STDERR: extend impl as I;
  17. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  18. // CHECK:STDERR: fail_extend_partially_defined_interface.carbon:[[@LINE-5]]:1: note: interface is currently being defined [InterfaceIncompleteWithinDefinition]
  19. // CHECK:STDERR: interface I {
  20. // CHECK:STDERR: ^~~~~~~~~~~~~
  21. // CHECK:STDERR:
  22. extend impl as I;
  23. }
  24. }
  25. // CHECK:STDOUT: --- fail_extend_partially_defined_interface.carbon
  26. // CHECK:STDOUT:
  27. // CHECK:STDOUT: constants {
  28. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  29. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  30. // CHECK:STDOUT: %C: type = class_type @C, @C(%Self) [symbolic]
  31. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness @C.%I.impl_witness_table, @impl(%Self) [symbolic]
  32. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  33. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  34. // CHECK:STDOUT: }
  35. // CHECK:STDOUT:
  36. // CHECK:STDOUT: imports {
  37. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  38. // CHECK:STDOUT: import Core//prelude
  39. // CHECK:STDOUT: import Core//prelude/...
  40. // CHECK:STDOUT: }
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT:
  43. // CHECK:STDOUT: file {
  44. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  45. // CHECK:STDOUT: .Core = imports.%Core
  46. // CHECK:STDOUT: .I = %I.decl
  47. // CHECK:STDOUT: }
  48. // CHECK:STDOUT: %Core.import = import Core
  49. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  50. // CHECK:STDOUT: }
  51. // CHECK:STDOUT:
  52. // CHECK:STDOUT: interface @I {
  53. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  54. // CHECK:STDOUT: %C.decl: type = class_decl @C [symbolic = constants.%C] {} {}
  55. // CHECK:STDOUT:
  56. // CHECK:STDOUT: !members:
  57. // CHECK:STDOUT: .Self = %Self
  58. // CHECK:STDOUT: .C = %C.decl
  59. // CHECK:STDOUT: .I = <poisoned>
  60. // CHECK:STDOUT: witness = ()
  61. // CHECK:STDOUT: }
  62. // CHECK:STDOUT:
  63. // CHECK:STDOUT: generic impl @impl(@I.%Self: %I.type) {
  64. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)]
  65. // CHECK:STDOUT: %C: type = class_type @C, @C(%Self) [symbolic = %C (constants.%C)]
  66. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness @C.%I.impl_witness_table, @impl(%Self) [symbolic = %I.impl_witness (constants.%I.impl_witness)]
  67. // CHECK:STDOUT:
  68. // CHECK:STDOUT: impl: %Self.ref as %I.ref;
  69. // CHECK:STDOUT: }
  70. // CHECK:STDOUT:
  71. // CHECK:STDOUT: generic class @C(@I.%Self: %I.type) {
  72. // CHECK:STDOUT: !definition:
  73. // CHECK:STDOUT:
  74. // CHECK:STDOUT: class {
  75. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  76. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [symbolic = %C (constants.%C)]
  77. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  78. // CHECK:STDOUT: }
  79. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @impl [concrete]
  80. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table, @impl(constants.%Self) [symbolic = @impl.%I.impl_witness (constants.%I.impl_witness)]
  81. // CHECK:STDOUT: %.loc23: type = specific_constant @impl.%I.ref, @impl(constants.%Self) [concrete = constants.%I.type]
  82. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  83. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  84. // CHECK:STDOUT: complete_type_witness = %complete_type
  85. // CHECK:STDOUT:
  86. // CHECK:STDOUT: !members:
  87. // CHECK:STDOUT: .Self = constants.%C
  88. // CHECK:STDOUT: .I = <poisoned>
  89. // CHECK:STDOUT: has_error
  90. // CHECK:STDOUT: }
  91. // CHECK:STDOUT: }
  92. // CHECK:STDOUT:
  93. // CHECK:STDOUT: specific @C(constants.%Self) {}
  94. // CHECK:STDOUT:
  95. // CHECK:STDOUT: specific @impl(constants.%Self) {
  96. // CHECK:STDOUT: %Self => constants.%Self
  97. // CHECK:STDOUT: %C => constants.%C
  98. // CHECK:STDOUT: %I.impl_witness => constants.%I.impl_witness
  99. // CHECK:STDOUT: }
  100. // CHECK:STDOUT: