fail_not_facet.carbon 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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/primitives.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/where_expr/fail_not_facet.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/where_expr/fail_not_facet.carbon
  12. // --- fail_left_where_not_facet.carbon
  13. library "[[@TEST_NAME]]";
  14. // CHECK:STDERR: fail_left_where_not_facet.carbon:[[@LINE+4]]:10: error: left argument of `where` operator must be a facet type [WhereOnNonFacetType]
  15. // CHECK:STDERR: fn F(T:! i32 where .Self == bool);
  16. // CHECK:STDERR: ^~~
  17. // CHECK:STDERR:
  18. fn F(T:! i32 where .Self == bool);
  19. // --- fail_left_where_unknown.carbon
  20. library "[[@TEST_NAME]]";
  21. // CHECK:STDERR: fail_left_where_unknown.carbon:[[@LINE+4]]:10: error: name `NOT_DECLARED` not found [NameNotFound]
  22. // CHECK:STDERR: fn G(U:! NOT_DECLARED where .Self == bool);
  23. // CHECK:STDERR: ^~~~~~~~~~~~
  24. // CHECK:STDERR:
  25. fn G(U:! NOT_DECLARED where .Self == bool);
  26. // --- fail_var.carbon
  27. library "[[@TEST_NAME]]";
  28. // CHECK:STDERR: fail_var.carbon:[[@LINE+4]]:8: error: name `e` not found [NameNotFound]
  29. // CHECK:STDERR: var v: e where .x = 3;
  30. // CHECK:STDERR: ^
  31. // CHECK:STDERR:
  32. var v: e where .x = 3;