fail_extend_partially_defined_interface.carbon 4.5 KB

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