params.carbon 2.0 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. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/uint.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/choice/params.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/choice/params.carbon
  12. // --- fail_todo_empty_params.carbon
  13. library "[[@TEST_NAME]]";
  14. choice Always {
  15. // CHECK:STDERR: fail_todo_empty_params.carbon:[[@LINE+4]]:8: error: semantics TODO: `empty parameter list should make a member function` [SemanticsTodo]
  16. // CHECK:STDERR: Sunny()
  17. // CHECK:STDERR: ^~
  18. // CHECK:STDERR:
  19. Sunny()
  20. }
  21. let mood: Always = Always.Sunny;
  22. // --- fail_todo_params.carbon
  23. library "[[@TEST_NAME]]";
  24. choice C {
  25. Alt1,
  26. // CHECK:STDERR: fail_todo_params.carbon:[[@LINE+4]]:7: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo]
  27. // CHECK:STDERR: Alt2(a: i32, b: i64),
  28. // CHECK:STDERR: ^~~~~~~~~~~~~~~~
  29. // CHECK:STDERR:
  30. Alt2(a: i32, b: i64),
  31. Alt3,
  32. }
  33. // --- fail_todo_generic_params.carbon
  34. library "[[@TEST_NAME]]";
  35. choice C(T:! type) {
  36. // CHECK:STDERR: fail_todo_generic_params.carbon:[[@LINE+4]]:6: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo]
  37. // CHECK:STDERR: Alt(a: T)
  38. // CHECK:STDERR: ^~~~~~
  39. // CHECK:STDERR:
  40. Alt(a: T)
  41. }
  42. // --- fail_todo_self_param.carbon
  43. library "[[@TEST_NAME]]";
  44. choice C {
  45. // CHECK:STDERR: fail_todo_self_param.carbon:[[@LINE+4]]:6: error: semantics TODO: `choice alternatives with parameters are not yet supported` [SemanticsTodo]
  46. // CHECK:STDERR: Alt(a: Self*)
  47. // CHECK:STDERR: ^~~~~~~~~~
  48. // CHECK:STDERR:
  49. Alt(a: Self*)
  50. }