params_one_comma.carbon 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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/definition/params_one_comma.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/params_one_comma.carbon
  13. fn Foo(a: i32,) {}
  14. // CHECK:STDOUT: --- params_one_comma.carbon
  15. // CHECK:STDOUT:
  16. // CHECK:STDOUT: constants {
  17. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  18. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  19. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  20. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  21. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  22. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [concrete]
  23. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [concrete]
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT:
  26. // CHECK:STDOUT: imports {
  27. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  28. // CHECK:STDOUT: .Int = %Core.Int
  29. // CHECK:STDOUT: import Core//prelude
  30. // CHECK:STDOUT: import Core//prelude/...
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  33. // CHECK:STDOUT: }
  34. // CHECK:STDOUT:
  35. // CHECK:STDOUT: file {
  36. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  37. // CHECK:STDOUT: .Core = imports.%Core
  38. // CHECK:STDOUT: .Foo = %Foo.decl
  39. // CHECK:STDOUT: }
  40. // CHECK:STDOUT: %Core.import = import Core
  41. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [concrete = constants.%Foo] {
  42. // CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete]
  43. // CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete]
  44. // CHECK:STDOUT: } {
  45. // CHECK:STDOUT: %a.param: %i32 = value_param call_param0
  46. // CHECK:STDOUT: %.loc14: type = splice_block %i32 [concrete = constants.%i32] {
  47. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  48. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  49. // CHECK:STDOUT: }
  50. // CHECK:STDOUT: %a: %i32 = bind_name a, %a.param
  51. // CHECK:STDOUT: }
  52. // CHECK:STDOUT: }
  53. // CHECK:STDOUT:
  54. // CHECK:STDOUT: fn @Foo(%a.param: %i32) {
  55. // CHECK:STDOUT: !entry:
  56. // CHECK:STDOUT: return
  57. // CHECK:STDOUT: }
  58. // CHECK:STDOUT: