fail_redef.carbon 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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+6]]:1: ERROR: Redefinition of `fn F`.
  12. // CHECK:STDERR: fn F() {}
  13. // CHECK:STDERR: ^~~~~~~~
  14. // CHECK:STDERR: fail_redef.carbon:[[@LINE-4]]:1: Previously defined here.
  15. // CHECK:STDERR: fn F() {}
  16. // CHECK:STDERR: ^~~~~~~~
  17. fn F() {}
  18. // CHECK:STDOUT: --- fail_redef.carbon
  19. // CHECK:STDOUT:
  20. // CHECK:STDOUT: constants {
  21. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  22. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  23. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT:
  26. // CHECK:STDOUT: file {
  27. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  28. // CHECK:STDOUT: .F = %F.decl.loc11
  29. // CHECK:STDOUT: }
  30. // CHECK:STDOUT: %F.decl.loc11: %F.type = fn_decl @F [template = constants.%F] {}
  31. // CHECK:STDOUT: %F.decl.loc18: %F.type = fn_decl @F [template = constants.%F] {}
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT:
  34. // CHECK:STDOUT: fn @F() {
  35. // CHECK:STDOUT: !entry:
  36. // CHECK:STDOUT: return
  37. // CHECK:STDOUT:
  38. // CHECK:STDOUT: !.loc18:
  39. // CHECK:STDOUT: return
  40. // CHECK:STDOUT: }
  41. // CHECK:STDOUT: