convert_facet_value_to_facet_value.carbon 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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/convert.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/facet/convert_facet_value_to_facet_value.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/convert_facet_value_to_facet_value.carbon
  12. // --- convert_concrete_facet_value_to_facet_value.carbon
  13. library "[[@TEST_NAME]]";
  14. interface Z {}
  15. interface Y {}
  16. class C {}
  17. impl C as Z {}
  18. impl C as Y {}
  19. fn G(z:! Z) {}
  20. fn F() {
  21. G(C);
  22. G(C as Y);
  23. G(C as Z);
  24. G(C as (Y & Z));
  25. G(((((C as Y) as type) as Y) as type) as Y);
  26. G((((((C as Y) as type) as Y) as type) as Y) as type);
  27. }
  28. // --- convert_symbolic_facet_value_to_facet_value.carbon
  29. library "[[@TEST_NAME]]";
  30. interface Z {}
  31. interface Y {}
  32. impl forall [T:! Y] T as Z {}
  33. fn F(U:! Y) {
  34. U as Z;
  35. }