fail_todo_no_params.carbon 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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_todo_no_params.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_todo_no_params.carbon
  14. // --- fail_no_body.carbon
  15. library "[[@TEST_NAME]]";
  16. // CHECK:STDERR: fail_no_body.carbon:[[@LINE+4]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo]
  17. // CHECK:STDERR: fn A;
  18. // CHECK:STDERR: ^~~~~
  19. // CHECK:STDERR:
  20. fn A;
  21. // --- fail_todo_brace_body.carbon
  22. library "[[@TEST_NAME]]";
  23. // CHECK:STDERR: fail_todo_brace_body.carbon:[[@LINE+4]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo]
  24. // CHECK:STDERR: fn A {
  25. // CHECK:STDERR: ^~~~~~
  26. // CHECK:STDERR:
  27. fn A {
  28. }
  29. // --- fail_todo_return_type.carbon
  30. library "[[@TEST_NAME]]";
  31. // CHECK:STDERR: fail_todo_return_type.carbon:[[@LINE+4]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo]
  32. // CHECK:STDERR: fn A -> ();
  33. // CHECK:STDERR: ^~~~~~~~~~~
  34. // CHECK:STDERR:
  35. fn A -> ();
  36. // --- fail_todo_implicit_only.carbon
  37. library "[[@TEST_NAME]]";
  38. // CHECK:STDERR: fail_todo_implicit_only.carbon:[[@LINE+4]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo]
  39. // CHECK:STDERR: fn A[] -> ();
  40. // CHECK:STDERR: ^~~~~~~~~~~~~
  41. // CHECK:STDERR:
  42. fn A[] -> ();
  43. // --- fail_todo_arrow_body.carbon
  44. // TODO: We don't have parsing support for this yet.
  45. library "[[@TEST_NAME]]";
  46. // CHECK:STDERR: fail_todo_arrow_body.carbon:[[@LINE+8]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo]
  47. // CHECK:STDERR: fn A => 0;
  48. // CHECK:STDERR: ^~~~~~~
  49. // CHECK:STDERR:
  50. // CHECK:STDERR: fail_todo_arrow_body.carbon:[[@LINE+4]]:6: error: semantics TODO: `HandleTerseBodyArrow` [SemanticsTodo]
  51. // CHECK:STDERR: fn A => 0;
  52. // CHECK:STDERR: ^~
  53. // CHECK:STDERR:
  54. fn A => 0;
  55. // --- fail_invalid_file_generic_regression_test.carbon
  56. library "[[@TEST_NAME]]";
  57. // CHECK:STDERR: fail_invalid_file_generic_regression_test.carbon:[[@LINE+8]]:5: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
  58. // CHECK:STDERR: var x:! () = ();
  59. // CHECK:STDERR: ^~~~~~
  60. // CHECK:STDERR:
  61. // CHECK:STDERR: fail_invalid_file_generic_regression_test.carbon:[[@LINE+4]]:12: error: found `:!` pattern inside `var` pattern [NonRegularBindingInVarDecl]
  62. // CHECK:STDERR: var x:! () = ();
  63. // CHECK:STDERR: ^
  64. // CHECK:STDERR:
  65. var x:! () = ();
  66. fn A {
  67. A();
  68. }
  69. // CHECK:STDOUT: --- fail_no_body.carbon
  70. // CHECK:STDOUT:
  71. // CHECK:STDOUT: constants {
  72. // CHECK:STDOUT: %A.type: type = fn_type @A [concrete]
  73. // CHECK:STDOUT: %A: %A.type = struct_value () [concrete]
  74. // CHECK:STDOUT: }
  75. // CHECK:STDOUT:
  76. // CHECK:STDOUT: file {
  77. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  78. // CHECK:STDOUT: .A = %A.decl
  79. // CHECK:STDOUT: }
  80. // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] {} {}
  81. // CHECK:STDOUT: }
  82. // CHECK:STDOUT:
  83. // CHECK:STDOUT: fn @A;
  84. // CHECK:STDOUT:
  85. // CHECK:STDOUT: --- fail_todo_brace_body.carbon
  86. // CHECK:STDOUT:
  87. // CHECK:STDOUT: constants {
  88. // CHECK:STDOUT: %A.type: type = fn_type @A [concrete]
  89. // CHECK:STDOUT: %A: %A.type = struct_value () [concrete]
  90. // CHECK:STDOUT: }
  91. // CHECK:STDOUT:
  92. // CHECK:STDOUT: file {
  93. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  94. // CHECK:STDOUT: .A = %A.decl
  95. // CHECK:STDOUT: }
  96. // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] {} {}
  97. // CHECK:STDOUT: }
  98. // CHECK:STDOUT:
  99. // CHECK:STDOUT: fn @A {
  100. // CHECK:STDOUT: !entry:
  101. // CHECK:STDOUT: return
  102. // CHECK:STDOUT: }
  103. // CHECK:STDOUT:
  104. // CHECK:STDOUT: --- fail_todo_return_type.carbon
  105. // CHECK:STDOUT:
  106. // CHECK:STDOUT: constants {
  107. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  108. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  109. // CHECK:STDOUT: %.262: Core.Form = init_form %empty_tuple.type [concrete]
  110. // CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete]
  111. // CHECK:STDOUT: %A.type: type = fn_type @A [concrete]
  112. // CHECK:STDOUT: %A: %A.type = struct_value () [concrete]
  113. // CHECK:STDOUT: }
  114. // CHECK:STDOUT:
  115. // CHECK:STDOUT: file {
  116. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  117. // CHECK:STDOUT: .A = %A.decl
  118. // CHECK:STDOUT: }
  119. // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] {
  120. // CHECK:STDOUT: %return.param_patt: %pattern_type = out_param_pattern [concrete]
  121. // CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern %return.param_patt, %.loc7_10.2 [concrete]
  122. // CHECK:STDOUT: } {
  123. // CHECK:STDOUT: %.loc7_10.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  124. // CHECK:STDOUT: %.loc7_10.2: type = converted %.loc7_10.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  125. // CHECK:STDOUT: %.loc7_10.3: Core.Form = init_form %.loc7_10.2 [concrete = constants.%.262]
  126. // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0
  127. // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
  128. // CHECK:STDOUT: }
  129. // CHECK:STDOUT: }
  130. // CHECK:STDOUT:
  131. // CHECK:STDOUT: fn @A() -> out %return.param: %empty_tuple.type;
  132. // CHECK:STDOUT:
  133. // CHECK:STDOUT: --- fail_todo_implicit_only.carbon
  134. // CHECK:STDOUT:
  135. // CHECK:STDOUT: constants {
  136. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  137. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  138. // CHECK:STDOUT: %.262: Core.Form = init_form %empty_tuple.type [concrete]
  139. // CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete]
  140. // CHECK:STDOUT: %A.type: type = fn_type @A [concrete]
  141. // CHECK:STDOUT: %A: %A.type = struct_value () [concrete]
  142. // CHECK:STDOUT: }
  143. // CHECK:STDOUT:
  144. // CHECK:STDOUT: file {
  145. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  146. // CHECK:STDOUT: .A = %A.decl
  147. // CHECK:STDOUT: }
  148. // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] {
  149. // CHECK:STDOUT: %return.param_patt: %pattern_type = out_param_pattern [concrete]
  150. // CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern %return.param_patt, %.loc7_12.2 [concrete]
  151. // CHECK:STDOUT: } {
  152. // CHECK:STDOUT: %.loc7_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  153. // CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  154. // CHECK:STDOUT: %.loc7_12.3: Core.Form = init_form %.loc7_12.2 [concrete = constants.%.262]
  155. // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0
  156. // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT: }
  159. // CHECK:STDOUT:
  160. // CHECK:STDOUT: fn @A() -> out %return.param: %empty_tuple.type;
  161. // CHECK:STDOUT:
  162. // CHECK:STDOUT: --- fail_todo_arrow_body.carbon
  163. // CHECK:STDOUT:
  164. // CHECK:STDOUT: fn @A;
  165. // CHECK:STDOUT:
  166. // CHECK:STDOUT: --- fail_invalid_file_generic_regression_test.carbon
  167. // CHECK:STDOUT: