fail_redef.carbon 1.8 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: type = fn_type @F [template]
  23. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  24. // CHECK:STDOUT: %.type: type = fn_type @.1 [template]
  25. // CHECK:STDOUT: %.d85: %.type = struct_value () [template]
  26. // CHECK:STDOUT: }
  27. // CHECK:STDOUT:
  28. // CHECK:STDOUT: file {
  29. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  30. // CHECK:STDOUT: .F = %F.decl
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
  33. // CHECK:STDOUT: %.decl: %.type = fn_decl @.1 [template = constants.%.d85] {} {}
  34. // CHECK:STDOUT: }
  35. // CHECK:STDOUT:
  36. // CHECK:STDOUT: fn @F() {
  37. // CHECK:STDOUT: !entry:
  38. // CHECK:STDOUT: return
  39. // CHECK:STDOUT: }
  40. // CHECK:STDOUT:
  41. // CHECK:STDOUT: fn @.1() {
  42. // CHECK:STDOUT: !entry:
  43. // CHECK:STDOUT: return
  44. // CHECK:STDOUT: }
  45. // CHECK:STDOUT: