symbolic.carbon 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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/bool.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/eval/symbolic.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/eval/symbolic.carbon
  12. // --- symbolic_call_to_eval_fn.carbon
  13. library "[[@TEST_NAME]]";
  14. eval fn F(B:! bool) -> type {
  15. if (B) { return (); }
  16. return ({}, {});
  17. }
  18. fn G(B:! bool) {
  19. let n: F(B) = ({}, {});
  20. }
  21. fn H() {
  22. G(false);
  23. }
  24. // --- fail_symbolic_call_to_eval_fn_invalid_instantiation.carbon
  25. // CHECK:STDERR: fail_symbolic_call_to_eval_fn_invalid_instantiation.carbon: error: cannot initialize tuple of 0 elements from tuple with 2 elements [TupleInitElementCountMismatch]
  26. // TODO: Provide a location for the error message.
  27. library "[[@TEST_NAME]]";
  28. eval fn F(B:! bool) -> type {
  29. if (B) { return (); }
  30. return ({}, {});
  31. }
  32. fn G(B:! bool) {
  33. let n: F(B) = ({}, {});
  34. }
  35. fn H() {
  36. // CHECK:STDERR: fail_symbolic_call_to_eval_fn_invalid_instantiation.carbon:[[@LINE+4]]:3: note: in `G(true)` used here [ResolvingSpecificHere]
  37. // CHECK:STDERR: G(true);
  38. // CHECK:STDERR: ^
  39. // CHECK:STDERR:
  40. G(true);
  41. }