fail_extend_undefined_interface.carbon 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. interface I;
  7. class C {
  8. // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE+6]]:3: ERROR: `extend impl` requires a definition for interface `I`.
  9. // CHECK:STDERR: extend impl as I;
  10. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  11. // CHECK:STDERR: fail_extend_undefined_interface.carbon:[[@LINE-6]]:1: Interface was forward declared here.
  12. // CHECK:STDERR: interface I;
  13. // CHECK:STDERR: ^~~~~~~~~~~~
  14. extend impl as I;
  15. }
  16. // CHECK:STDOUT: --- fail_extend_undefined_interface.carbon
  17. // CHECK:STDOUT:
  18. // CHECK:STDOUT: constants {
  19. // CHECK:STDOUT: %.1: type = interface_type @I [template]
  20. // CHECK:STDOUT: %C: type = class_type @C [template]
  21. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  22. // CHECK:STDOUT: }
  23. // CHECK:STDOUT:
  24. // CHECK:STDOUT: file {
  25. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  26. // CHECK:STDOUT: .I = %I.decl
  27. // CHECK:STDOUT: .C = %C.decl
  28. // CHECK:STDOUT: }
  29. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {}
  30. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT:
  33. // CHECK:STDOUT: interface @I;
  34. // CHECK:STDOUT:
  35. // CHECK:STDOUT: impl @impl: C as I;
  36. // CHECK:STDOUT:
  37. // CHECK:STDOUT: class @C {
  38. // CHECK:STDOUT: impl_decl @impl {
  39. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1]
  40. // CHECK:STDOUT: }
  41. // CHECK:STDOUT:
  42. // CHECK:STDOUT: !members:
  43. // CHECK:STDOUT: .Self = constants.%C
  44. // CHECK:STDOUT: has_error
  45. // CHECK:STDOUT: }
  46. // CHECK:STDOUT: