| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
- // Exceptions. See /LICENSE for license information.
- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- //
- // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
- // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
- // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
- //
- // AUTOUPDATE
- // TIP: To test this file alone, run:
- // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/declaration/fail_todo_no_params.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/fail_todo_no_params.carbon
- // --- fail_no_body.carbon
- library "[[@TEST_NAME]]";
- // CHECK:STDERR: fail_no_body.carbon:[[@LINE+4]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo]
- // CHECK:STDERR: fn A;
- // CHECK:STDERR: ^~~~~
- // CHECK:STDERR:
- fn A;
- // --- fail_todo_brace_body.carbon
- library "[[@TEST_NAME]]";
- // CHECK:STDERR: fail_todo_brace_body.carbon:[[@LINE+4]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo]
- // CHECK:STDERR: fn A {
- // CHECK:STDERR: ^~~~~~
- // CHECK:STDERR:
- fn A {
- }
- // --- fail_todo_return_type.carbon
- library "[[@TEST_NAME]]";
- // CHECK:STDERR: fail_todo_return_type.carbon:[[@LINE+4]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo]
- // CHECK:STDERR: fn A -> ();
- // CHECK:STDERR: ^~~~~~~~~~~
- // CHECK:STDERR:
- fn A -> ();
- // --- fail_todo_implicit_only.carbon
- library "[[@TEST_NAME]]";
- // CHECK:STDERR: fail_todo_implicit_only.carbon:[[@LINE+4]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo]
- // CHECK:STDERR: fn A[] -> ();
- // CHECK:STDERR: ^~~~~~~~~~~~~
- // CHECK:STDERR:
- fn A[] -> ();
- // --- fail_todo_arrow_body.carbon
- // TODO: We don't have parsing support for this yet.
- library "[[@TEST_NAME]]";
- // CHECK:STDERR: fail_todo_arrow_body.carbon:[[@LINE+8]]:1: error: semantics TODO: `function with positional parameters` [SemanticsTodo]
- // CHECK:STDERR: fn A => 0;
- // CHECK:STDERR: ^~~~~~~
- // CHECK:STDERR:
- // CHECK:STDERR: fail_todo_arrow_body.carbon:[[@LINE+4]]:6: error: semantics TODO: `HandleTerseBodyArrow` [SemanticsTodo]
- // CHECK:STDERR: fn A => 0;
- // CHECK:STDERR: ^~
- // CHECK:STDERR:
- fn A => 0;
- // --- fail_invalid_file_generic_regression_test.carbon
- library "[[@TEST_NAME]]";
- // CHECK:STDERR: fail_invalid_file_generic_regression_test.carbon:[[@LINE+8]]:5: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
- // CHECK:STDERR: var x:! () = ();
- // CHECK:STDERR: ^~~~~~
- // CHECK:STDERR:
- // CHECK:STDERR: fail_invalid_file_generic_regression_test.carbon:[[@LINE+4]]:12: error: found `:!` pattern inside `var` pattern [NonRegularBindingInVarDecl]
- // CHECK:STDERR: var x:! () = ();
- // CHECK:STDERR: ^
- // CHECK:STDERR:
- var x:! () = ();
- fn A {
- A();
- }
- // CHECK:STDOUT: --- fail_no_body.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %A.type: type = fn_type @A [concrete]
- // CHECK:STDOUT: %A: %A.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .A = %A.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @A;
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_todo_brace_body.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %A.type: type = fn_type @A [concrete]
- // CHECK:STDOUT: %A: %A.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .A = %A.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @A {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_todo_return_type.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
- // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
- // CHECK:STDOUT: %.262: Core.Form = init_form %empty_tuple.type [concrete]
- // CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete]
- // CHECK:STDOUT: %A.type: type = fn_type @A [concrete]
- // CHECK:STDOUT: %A: %A.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .A = %A.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] {
- // CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern [concrete]
- // CHECK:STDOUT: %return.param_patt: %pattern_type = out_param_pattern %return.patt [concrete]
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %.loc7_10.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
- // CHECK:STDOUT: %.loc7_10.2: type = converted %.loc7_10.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
- // CHECK:STDOUT: %.loc7_10.3: Core.Form = init_form %.loc7_10.2 [concrete = constants.%.262]
- // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0
- // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @A() -> out %return.param: %empty_tuple.type;
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_todo_implicit_only.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
- // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
- // CHECK:STDOUT: %.262: Core.Form = init_form %empty_tuple.type [concrete]
- // CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete]
- // CHECK:STDOUT: %A.type: type = fn_type @A [concrete]
- // CHECK:STDOUT: %A: %A.type = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .A = %A.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] {
- // CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern [concrete]
- // CHECK:STDOUT: %return.param_patt: %pattern_type = out_param_pattern %return.patt [concrete]
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %.loc7_12.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
- // CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
- // CHECK:STDOUT: %.loc7_12.3: Core.Form = init_form %.loc7_12.2 [concrete = constants.%.262]
- // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0
- // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @A() -> out %return.param: %empty_tuple.type;
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_todo_arrow_body.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @A;
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_invalid_file_generic_regression_test.carbon
- // CHECK:STDOUT:
|