fail_pattern_in_signature.carbon 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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/none.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/fail_pattern_in_signature.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/fail_pattern_in_signature.carbon
  14. // CHECK:STDERR: fail_pattern_in_signature.carbon:[[@LINE+4]]:6: error: semantics TODO: `Support patterns besides bindings in parameter list` [SemanticsTodo]
  15. // CHECK:STDERR: fn F((a: {}, b: {}), c: {});
  16. // CHECK:STDERR: ^~~~~~~~~~~~~~
  17. // CHECK:STDERR:
  18. fn F((a: {}, b: {}), c: {});
  19. // CHECK:STDOUT: --- fail_pattern_in_signature.carbon
  20. // CHECK:STDOUT:
  21. // CHECK:STDOUT: constants {
  22. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  23. // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete]
  24. // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_struct_type, %empty_struct_type) [concrete]
  25. // CHECK:STDOUT: %pattern_type.de4: type = pattern_type %tuple.type [concrete]
  26. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  27. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  28. // CHECK:STDOUT: }
  29. // CHECK:STDOUT:
  30. // CHECK:STDOUT: file {
  31. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  32. // CHECK:STDOUT: .F = %F.decl
  33. // CHECK:STDOUT: }
  34. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  35. // CHECK:STDOUT: %a.patt: %pattern_type.a96 = binding_pattern a [concrete]
  36. // CHECK:STDOUT: %a.param_patt: %pattern_type.a96 = value_param_pattern %a.patt, call_param<none> [concrete]
  37. // CHECK:STDOUT: %b.patt: %pattern_type.a96 = binding_pattern b [concrete]
  38. // CHECK:STDOUT: %b.param_patt: %pattern_type.a96 = value_param_pattern %b.patt, call_param<none> [concrete]
  39. // CHECK:STDOUT: %.loc19_19: %pattern_type.de4 = tuple_pattern (%a.param_patt, %b.param_patt) [concrete]
  40. // CHECK:STDOUT: %c.patt: %pattern_type.a96 = binding_pattern c [concrete]
  41. // CHECK:STDOUT: %c.param_patt: %pattern_type.a96 = value_param_pattern %c.patt, call_param0 [concrete]
  42. // CHECK:STDOUT: } {
  43. // CHECK:STDOUT: %c.param: %empty_struct_type = value_param call_param0
  44. // CHECK:STDOUT: %.loc19_26.1: type = splice_block %.loc19_26.3 [concrete = constants.%empty_struct_type] {
  45. // CHECK:STDOUT: %.loc19_26.2: %empty_struct_type = struct_literal ()
  46. // CHECK:STDOUT: %.loc19_26.3: type = converted %.loc19_26.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  47. // CHECK:STDOUT: }
  48. // CHECK:STDOUT: %c: %empty_struct_type = bind_name c, %c.param
  49. // CHECK:STDOUT: }
  50. // CHECK:STDOUT: }
  51. // CHECK:STDOUT:
  52. // CHECK:STDOUT: fn @F(%c.param: %empty_struct_type);
  53. // CHECK:STDOUT: