fail_method_redefinition.carbon 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. class Class {
  7. fn F() {}
  8. // CHECK:STDERR: fail_method_redefinition.carbon:[[@LINE+6]]:3: ERROR: Redefinition of function F.
  9. // CHECK:STDERR: fn F() {}
  10. // CHECK:STDERR: ^~~~~~~~
  11. // CHECK:STDERR: fail_method_redefinition.carbon:[[@LINE-4]]:3: Previously defined here.
  12. // CHECK:STDERR: fn F() {}
  13. // CHECK:STDERR: ^~~~~~~~
  14. fn F() {}
  15. }
  16. // CHECK:STDOUT: --- fail_method_redefinition.carbon
  17. // CHECK:STDOUT:
  18. // CHECK:STDOUT: constants {
  19. // CHECK:STDOUT: %Class: type = class_type @Class [template]
  20. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  21. // CHECK:STDOUT: }
  22. // CHECK:STDOUT:
  23. // CHECK:STDOUT: file {
  24. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  25. // CHECK:STDOUT: .Core = %Core
  26. // CHECK:STDOUT: .Class = %Class.decl
  27. // CHECK:STDOUT: }
  28. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  29. // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {}
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT:
  32. // CHECK:STDOUT: class @Class {
  33. // CHECK:STDOUT: %F.loc8: <function> = fn_decl @F [template] {}
  34. // CHECK:STDOUT: %F.loc15: <function> = fn_decl @F [template] {}
  35. // CHECK:STDOUT:
  36. // CHECK:STDOUT: !members:
  37. // CHECK:STDOUT: .Self = constants.%Class
  38. // CHECK:STDOUT: .F = %F.loc8
  39. // CHECK:STDOUT: }
  40. // CHECK:STDOUT:
  41. // CHECK:STDOUT: fn @F() {
  42. // CHECK:STDOUT: !entry:
  43. // CHECK:STDOUT: return
  44. // CHECK:STDOUT:
  45. // CHECK:STDOUT: !.loc15:
  46. // CHECK:STDOUT: return
  47. // CHECK:STDOUT: }
  48. // CHECK:STDOUT: