fail_extend_impl_forall.carbon 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. // CHECK:STDERR: fail_extend_impl_forall.carbon:[[@LINE+3]]:1: ERROR: Semantics TODO: `generic interface`.
  7. // CHECK:STDERR: interface GenericInterface(T:! type) {
  8. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  9. interface GenericInterface(T:! type) {
  10. fn F(x: T);
  11. }
  12. class C {
  13. // CHECK:STDERR: fail_extend_impl_forall.carbon:[[@LINE+6]]:3: ERROR: Cannot `extend` a parameterized `impl`.
  14. // CHECK:STDERR: extend impl forall [T:! type] as GenericInterface(T) {
  15. // CHECK:STDERR: ^~~~~~
  16. // CHECK:STDERR: fail_extend_impl_forall.carbon:[[@LINE+3]]:36: ERROR: Value of type `type` is not callable.
  17. // CHECK:STDERR: extend impl forall [T:! type] as GenericInterface(T) {
  18. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  19. extend impl forall [T:! type] as GenericInterface(T) {
  20. fn F(x: T) {}
  21. }
  22. }
  23. // CHECK:STDOUT: --- fail_extend_impl_forall.carbon
  24. // CHECK:STDOUT:
  25. // CHECK:STDOUT: constants {
  26. // CHECK:STDOUT: %.1: type = interface_type @GenericInterface [template]
  27. // CHECK:STDOUT: %.2: type = assoc_entity_type @GenericInterface, <function> [template]
  28. // CHECK:STDOUT: %.3: <associated <function> in GenericInterface> = assoc_entity element0, @GenericInterface.%F [template]
  29. // CHECK:STDOUT: %C: type = class_type @C [template]
  30. // CHECK:STDOUT: %.4: type = struct_type {} [template]
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT:
  33. // CHECK:STDOUT: file {
  34. // CHECK:STDOUT: package: <namespace> = namespace {.GenericInterface = %GenericInterface.decl, .C = %C.decl} [template]
  35. // CHECK:STDOUT: %GenericInterface.decl = interface_decl @GenericInterface, (<unexpected instref inst+1>, <unexpected instref inst+2>) [template = constants.%.1]
  36. // CHECK:STDOUT: %C.decl = class_decl @C, () [template = constants.%C]
  37. // CHECK:STDOUT: }
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: interface @GenericInterface {
  40. // CHECK:STDOUT: %F: <function> = fn_decl @F.1 [template]
  41. // CHECK:STDOUT: %.loc11: <associated <function> in GenericInterface> = assoc_entity element0, %F [template = constants.%.3]
  42. // CHECK:STDOUT:
  43. // CHECK:STDOUT: !members:
  44. // CHECK:STDOUT: .F = %.loc11
  45. // CHECK:STDOUT: witness = (%F)
  46. // CHECK:STDOUT: }
  47. // CHECK:STDOUT:
  48. // CHECK:STDOUT: impl @impl: C as <error> {
  49. // CHECK:STDOUT: %F: <function> = fn_decl @F.2 [template]
  50. // CHECK:STDOUT:
  51. // CHECK:STDOUT: !members:
  52. // CHECK:STDOUT: .F = %F
  53. // CHECK:STDOUT: }
  54. // CHECK:STDOUT:
  55. // CHECK:STDOUT: class @C {
  56. // CHECK:STDOUT: impl_decl @impl, (<unexpected instref inst+14>, <unexpected instref inst+15>, <unexpected instref inst+16>, <unexpected instref inst+17>)
  57. // CHECK:STDOUT:
  58. // CHECK:STDOUT: !members:
  59. // CHECK:STDOUT: has_error
  60. // CHECK:STDOUT: }
  61. // CHECK:STDOUT:
  62. // CHECK:STDOUT: fn @F.1(%x: T);
  63. // CHECK:STDOUT:
  64. // CHECK:STDOUT: fn @F.2(%x: T) {
  65. // CHECK:STDOUT: !entry:
  66. // CHECK:STDOUT: return
  67. // CHECK:STDOUT: }
  68. // CHECK:STDOUT: