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