params_two_comma.carbon 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. fn Foo(a: i32, b: i32,) {}
  7. fn Main() {
  8. Foo(1, 2);
  9. Foo(1, 2,);
  10. }
  11. // CHECK:STDOUT: --- params_two_comma.carbon
  12. // CHECK:STDOUT:
  13. // CHECK:STDOUT: constants {
  14. // CHECK:STDOUT: %Foo: type = fn_type @Foo [template]
  15. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  16. // CHECK:STDOUT: %struct.1: Foo = struct_value () [template]
  17. // CHECK:STDOUT: %Main: type = fn_type @Main [template]
  18. // CHECK:STDOUT: %struct.2: Main = struct_value () [template]
  19. // CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
  20. // CHECK:STDOUT: %.3: i32 = int_literal 2 [template]
  21. // CHECK:STDOUT: }
  22. // CHECK:STDOUT:
  23. // CHECK:STDOUT: file {
  24. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  25. // CHECK:STDOUT: .Core = %Core
  26. // CHECK:STDOUT: .Foo = %Foo.decl
  27. // CHECK:STDOUT: .Main = %Main.decl
  28. // CHECK:STDOUT: }
  29. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  30. // CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.1] {
  31. // CHECK:STDOUT: %a.loc7_8.1: i32 = param a
  32. // CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1
  33. // CHECK:STDOUT: %b.loc7_16.1: i32 = param b
  34. // CHECK:STDOUT: @Foo.%b: i32 = bind_name b, %b.loc7_16.1
  35. // CHECK:STDOUT: }
  36. // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {}
  37. // CHECK:STDOUT: }
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) {
  40. // CHECK:STDOUT: !entry:
  41. // CHECK:STDOUT: return
  42. // CHECK:STDOUT: }
  43. // CHECK:STDOUT:
  44. // CHECK:STDOUT: fn @Main() {
  45. // CHECK:STDOUT: !entry:
  46. // CHECK:STDOUT: %Foo.ref.loc10: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1]
  47. // CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 [template = constants.%.2]
  48. // CHECK:STDOUT: %.loc10_10: i32 = int_literal 2 [template = constants.%.3]
  49. // CHECK:STDOUT: %Foo.call.loc10: init () = call %Foo.ref.loc10(%.loc10_7, %.loc10_10)
  50. // CHECK:STDOUT: %Foo.ref.loc11: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1]
  51. // CHECK:STDOUT: %.loc11_7: i32 = int_literal 1 [template = constants.%.2]
  52. // CHECK:STDOUT: %.loc11_10: i32 = int_literal 2 [template = constants.%.3]
  53. // CHECK:STDOUT: %Foo.call.loc11: init () = call %Foo.ref.loc11(%.loc11_7, %.loc11_10)
  54. // CHECK:STDOUT: return
  55. // CHECK:STDOUT: }
  56. // CHECK:STDOUT: