param_same_name.carbon 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  6. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  7. //
  8. // AUTOUPDATE
  9. // TIP: To test this file alone, run:
  10. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/declaration/param_same_name.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/param_same_name.carbon
  13. fn F(a: i32);
  14. fn G(a: i32);
  15. // CHECK:STDOUT: --- param_same_name.carbon
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: constants {
  18. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  19. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  20. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  21. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  22. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  23. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  24. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  25. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  26. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  27. // CHECK:STDOUT: }
  28. // CHECK:STDOUT:
  29. // CHECK:STDOUT: imports {
  30. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  31. // CHECK:STDOUT: .Int = %Core.Int
  32. // CHECK:STDOUT: import Core//prelude
  33. // CHECK:STDOUT: import Core//prelude/...
  34. // CHECK:STDOUT: }
  35. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT:
  38. // CHECK:STDOUT: file {
  39. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  40. // CHECK:STDOUT: .Core = imports.%Core
  41. // CHECK:STDOUT: .F = %F.decl
  42. // CHECK:STDOUT: .G = %G.decl
  43. // CHECK:STDOUT: }
  44. // CHECK:STDOUT: %Core.import = import Core
  45. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  46. // CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete]
  47. // CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete]
  48. // CHECK:STDOUT: } {
  49. // CHECK:STDOUT: %a.param: %i32 = value_param call_param0
  50. // CHECK:STDOUT: %.loc14: type = splice_block %i32 [concrete = constants.%i32] {
  51. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  52. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  53. // CHECK:STDOUT: }
  54. // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param
  55. // CHECK:STDOUT: }
  56. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  57. // CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete]
  58. // CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete]
  59. // CHECK:STDOUT: } {
  60. // CHECK:STDOUT: %a.param: %i32 = value_param call_param0
  61. // CHECK:STDOUT: %.loc16: type = splice_block %i32 [concrete = constants.%i32] {
  62. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  63. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  64. // CHECK:STDOUT: }
  65. // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param
  66. // CHECK:STDOUT: }
  67. // CHECK:STDOUT: }
  68. // CHECK:STDOUT:
  69. // CHECK:STDOUT: fn @F(%a.param: %i32);
  70. // CHECK:STDOUT:
  71. // CHECK:STDOUT: fn @G(%a.param: %i32);
  72. // CHECK:STDOUT: