fail_redef.carbon 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/definition/no_prelude/fail_redef.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/no_prelude/fail_redef.carbon
  10. fn F() {}
  11. // CHECK:STDERR: fail_redef.carbon:[[@LINE+7]]:1: error: redefinition of `fn F` [RedeclRedef]
  12. // CHECK:STDERR: fn F() {}
  13. // CHECK:STDERR: ^~~~~~~~
  14. // CHECK:STDERR: fail_redef.carbon:[[@LINE-4]]:1: note: previously defined here [RedeclPrevDef]
  15. // CHECK:STDERR: fn F() {}
  16. // CHECK:STDERR: ^~~~~~~~
  17. // CHECK:STDERR:
  18. fn F() {}
  19. // CHECK:STDOUT: --- fail_redef.carbon
  20. // CHECK:STDOUT:
  21. // CHECK:STDOUT: constants {
  22. // CHECK:STDOUT: %F.type.b25846.1: type = fn_type @F.1 [concrete]
  23. // CHECK:STDOUT: %F.c41931.1: %F.type.b25846.1 = struct_value () [concrete]
  24. // CHECK:STDOUT: %F.type.b25846.2: type = fn_type @F.2 [concrete]
  25. // CHECK:STDOUT: %F.c41931.2: %F.type.b25846.2 = struct_value () [concrete]
  26. // CHECK:STDOUT: }
  27. // CHECK:STDOUT:
  28. // CHECK:STDOUT: file {
  29. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  30. // CHECK:STDOUT: .F = %F.decl.loc11
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT: %F.decl.loc11: %F.type.b25846.1 = fn_decl @F.1 [concrete = constants.%F.c41931.1] {} {}
  33. // CHECK:STDOUT: %F.decl.loc19: %F.type.b25846.2 = fn_decl @F.2 [concrete = constants.%F.c41931.2] {} {}
  34. // CHECK:STDOUT: }
  35. // CHECK:STDOUT:
  36. // CHECK:STDOUT: fn @F.1() {
  37. // CHECK:STDOUT: !entry:
  38. // CHECK:STDOUT: return
  39. // CHECK:STDOUT: }
  40. // CHECK:STDOUT:
  41. // CHECK:STDOUT: fn @F.2() {
  42. // CHECK:STDOUT: !entry:
  43. // CHECK:STDOUT: return
  44. // CHECK:STDOUT: }
  45. // CHECK:STDOUT: