fail_implied_constraints.carbon 782 B

12345678910111213141516171819202122232425
  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. package ExplorerTest api;
  7. interface X(T:! type) {}
  8. interface Y(T:! type) {
  9. let M:! X(T);
  10. }
  11. interface Z {
  12. // We reject this even though it is the responsibility of the `impl as Z` to
  13. // provide a type `N` such that `i32 is X(N)`. We might want to treat this as
  14. // an implied constraint and allow this in the future.
  15. // 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
  16. let N:! Y(.Self) where .M = i32;
  17. }
  18. fn Main() -> i32 {
  19. return 0;
  20. }