Files
carbon-lang/toolchain/check/testdata/choice/params.carbon
T
Jon Ross-Perkins 2c013ada42 Update choice tests for ranges (#5525)
Note the amount of IR excluded is pretty small, but non-zero (mainly
prelude-related, due to the way a choice depends on `UInt`)

Renaming fail_todo_params.carbon to just params.carbon, and folding in
fail_invalid.carbon.
2025-05-22 22:34:12 +00:00

60 lines
1.9 KiB
Plaintext

// 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
//
// EXTRA-ARGS: --dump-sem-ir-ranges=only
//
// AUTOUPDATE
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/choice/params.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/choice/params.carbon
// --- fail_todo_empty_params.carbon
library "[[@TEST_NAME]]";
choice Always {
// CHECK:STDERR: fail_todo_empty_params.carbon:[[@LINE+4]]:8: error: semantics TODO: `empty parameter list should make a member function` [SemanticsTodo]
// CHECK:STDERR: Sunny()
// CHECK:STDERR: ^~
// CHECK:STDERR:
Sunny()
}
let mood: Always = Always.Sunny;
// --- fail_todo_params.carbon
library "[[@TEST_NAME]]";
choice C {
Alt1,
// CHECK:STDERR: fail_todo_params.carbon:[[@LINE+4]]:7: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo]
// CHECK:STDERR: Alt2(a: i32, b: i64),
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
// CHECK:STDERR:
Alt2(a: i32, b: i64),
Alt3,
}
// --- fail_todo_generic_params.carbon
library "[[@TEST_NAME]]";
choice C(T:! type) {
// CHECK:STDERR: fail_todo_generic_params.carbon:[[@LINE+4]]:6: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo]
// CHECK:STDERR: Alt(a: T)
// CHECK:STDERR: ^~~~~~
// CHECK:STDERR:
Alt(a: T)
}
// --- fail_todo_self_param.carbon
library "[[@TEST_NAME]]";
choice C {
// CHECK:STDERR: fail_todo_self_param.carbon:[[@LINE+4]]:6: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo]
// CHECK:STDERR: Alt(a: Self*)
// CHECK:STDERR: ^~~~~~~~~~
// CHECK:STDERR:
Alt(a: Self*)
}