where.carbon 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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/none.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/deduce/where.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/deduce/where.carbon
  12. // --- fail_todo_where.carbon
  13. library "[[@TEST_NAME]]";
  14. interface Z {
  15. let Z1:! type;
  16. }
  17. class C(T:! type) {}
  18. fn F[U:! type](T:! Z where .Z1 = C(U)) {}
  19. class D {}
  20. final impl () as Z where .Z1 = C(D) {}
  21. fn G() {
  22. // TODO: Should be able to see that ().(Z.Z1) is C(D), so deduce that C(U)
  23. // is C(D) and U is D.
  24. //
  25. // CHECK:STDERR: fail_todo_where.carbon:[[@LINE+7]]:3: error: cannot deduce value for generic parameter `U` [DeductionIncomplete]
  26. // CHECK:STDERR: F(() as type);
  27. // CHECK:STDERR: ^~~~~~~~~~~~~
  28. // CHECK:STDERR: fail_todo_where.carbon:[[@LINE-12]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  29. // CHECK:STDERR: fn F[U:! type](T:! Z where .Z1 = C(U)) {}
  30. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  31. // CHECK:STDERR:
  32. F(() as type);
  33. }