param_same_name.carbon 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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/declaration/param_same_name.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/param_same_name.carbon
  10. fn F(a: i32);
  11. fn G(a: i32);
  12. // CHECK:STDOUT: --- param_same_name.carbon
  13. // CHECK:STDOUT:
  14. // CHECK:STDOUT: constants {
  15. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  16. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  17. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  18. // CHECK:STDOUT: %i32: type = int_type signed, %int_32 [template]
  19. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  20. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  21. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  22. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  23. // CHECK:STDOUT: }
  24. // CHECK:STDOUT:
  25. // CHECK:STDOUT: imports {
  26. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  27. // CHECK:STDOUT: .Int = %import_ref
  28. // CHECK:STDOUT: import Core//prelude
  29. // CHECK:STDOUT: import Core//prelude/...
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT:
  33. // CHECK:STDOUT: file {
  34. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  35. // CHECK:STDOUT: .Core = imports.%Core
  36. // CHECK:STDOUT: .F = %F.decl
  37. // CHECK:STDOUT: .G = %G.decl
  38. // CHECK:STDOUT: }
  39. // CHECK:STDOUT: %Core.import = import Core
  40. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  41. // CHECK:STDOUT: %a.patt: %i32 = binding_pattern a
  42. // CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0
  43. // CHECK:STDOUT: } {
  44. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  45. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%int_32) [template = constants.%i32]
  46. // CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_signed [template = constants.%i32]
  47. // CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_signed, %.loc11_9.1 [template = constants.%i32]
  48. // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0
  49. // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param
  50. // CHECK:STDOUT: }
  51. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  52. // CHECK:STDOUT: %a.patt: %i32 = binding_pattern a
  53. // CHECK:STDOUT: %a.param_patt: %i32 = value_param_pattern %a.patt, runtime_param0
  54. // CHECK:STDOUT: } {
  55. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  56. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%int_32) [template = constants.%i32]
  57. // CHECK:STDOUT: %.loc13_9.1: type = value_of_initializer %int.make_type_signed [template = constants.%i32]
  58. // CHECK:STDOUT: %.loc13_9.2: type = converted %int.make_type_signed, %.loc13_9.1 [template = constants.%i32]
  59. // CHECK:STDOUT: %a.param: %i32 = value_param runtime_param0
  60. // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param
  61. // CHECK:STDOUT: }
  62. // CHECK:STDOUT: }
  63. // CHECK:STDOUT:
  64. // CHECK:STDOUT: fn @F(%a.param_patt: %i32);
  65. // CHECK:STDOUT:
  66. // CHECK:STDOUT: fn @G(%a.param_patt: %i32);
  67. // CHECK:STDOUT: