params_two_comma.carbon 3.4 KB

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