fail_method_redefinition.carbon 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 `fn 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: %F: type = fn_type @F [template]
  21. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  22. // CHECK:STDOUT: %struct: F = struct_value () [template]
  23. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT:
  26. // CHECK:STDOUT: file {
  27. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  28. // CHECK:STDOUT: .Core = %Core
  29. // CHECK:STDOUT: .Class = %Class.decl
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  32. // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {}
  33. // CHECK:STDOUT: }
  34. // CHECK:STDOUT:
  35. // CHECK:STDOUT: class @Class {
  36. // CHECK:STDOUT: %F.decl.loc8: F = fn_decl @F [template = constants.%struct] {}
  37. // CHECK:STDOUT: %F.decl.loc15: F = fn_decl @F [template = constants.%struct] {}
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: !members:
  40. // CHECK:STDOUT: .Self = constants.%Class
  41. // CHECK:STDOUT: .F = %F.decl.loc8
  42. // CHECK:STDOUT: }
  43. // CHECK:STDOUT:
  44. // CHECK:STDOUT: fn @F() {
  45. // CHECK:STDOUT: !entry:
  46. // CHECK:STDOUT: return
  47. // CHECK:STDOUT:
  48. // CHECK:STDOUT: !.loc15:
  49. // CHECK:STDOUT: return
  50. // CHECK:STDOUT: }
  51. // CHECK:STDOUT: