fail_redeclare_member.carbon 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 Interface {
  7. fn F();
  8. // CHECK:STDERR: fail_redeclare_member.carbon:[[@LINE+6]]:3: ERROR: Duplicate name being declared in the same scope.
  9. // CHECK:STDERR: fn F();
  10. // CHECK:STDERR: ^~~~~~~
  11. // CHECK:STDERR: fail_redeclare_member.carbon:[[@LINE-4]]:3: Name is previously declared here.
  12. // CHECK:STDERR: fn F();
  13. // CHECK:STDERR: ^~~~~~~
  14. fn F();
  15. }
  16. // CHECK:STDOUT: --- fail_redeclare_member.carbon
  17. // CHECK:STDOUT:
  18. // CHECK:STDOUT: constants {
  19. // CHECK:STDOUT: %.1: type = interface_type @Interface [template]
  20. // CHECK:STDOUT: %.2: type = assoc_entity_type @Interface, <function> [template]
  21. // CHECK:STDOUT: %.3: <associated <function> in Interface> = assoc_entity element0, @Interface.%F [template]
  22. // CHECK:STDOUT: }
  23. // CHECK:STDOUT:
  24. // CHECK:STDOUT: file {
  25. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  26. // CHECK:STDOUT: .Interface = %Interface.decl
  27. // CHECK:STDOUT: }
  28. // CHECK:STDOUT: %Interface.decl: type = interface_decl @Interface [template = constants.%.1] {}
  29. // CHECK:STDOUT: }
  30. // CHECK:STDOUT:
  31. // CHECK:STDOUT: interface @Interface {
  32. // CHECK:STDOUT: %Self: Interface = bind_symbolic_name Self [symbolic]
  33. // CHECK:STDOUT: %F: <function> = fn_decl @F [template] {}
  34. // CHECK:STDOUT: %.loc8: <associated <function> in Interface> = assoc_entity element0, %F [template = constants.%.3]
  35. // CHECK:STDOUT: %.loc15: <function> = fn_decl @.1 [template] {}
  36. // CHECK:STDOUT:
  37. // CHECK:STDOUT: !members:
  38. // CHECK:STDOUT: .Self = %Self
  39. // CHECK:STDOUT: .F = %.loc8
  40. // CHECK:STDOUT: witness = (%F)
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT:
  43. // CHECK:STDOUT: fn @F();
  44. // CHECK:STDOUT:
  45. // CHECK:STDOUT: fn @.1();
  46. // CHECK:STDOUT: