fail_implied_constraints.carbon 857 B

123456789101112131415161718192021222324252627
  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. // AUTOUPDATE
  6. // RUN: %{not} %{explorer-run}
  7. // RUN: %{not} %{explorer-run-trace}
  8. package ExplorerTest api;
  9. interface X(T:! type) {}
  10. interface Y(T:! type) {
  11. let M:! X(T);
  12. }
  13. interface Z {
  14. // We reject this even though it is the responsibility of the `impl as Z` to
  15. // provide a type `N` such that `i32 is X(N)`. We might want to treat this as
  16. // an implied constraint and allow this in the future.
  17. // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/assoc_const/fail_implied_constraints.carbon:[[@LINE+1]]: could not find implementation of interface X(T = N) for i32
  18. let N:! Y(.Self) where .M = i32;
  19. }
  20. fn Main() -> i32 {
  21. return 0;
  22. }