impl_used_by_later_rewrite.carbon 677 B

12345678910111213141516171819202122232425262728293031
  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. // The `i32 impls X(.Self)` constraint is indirectly required by
  13. // specifying that `.M = i32`.
  14. let N:! Y(.Self) where i32 impls X(.Self) and .M = i32;
  15. }
  16. impl i32 as X(i32) {}
  17. impl i32 as Y(i32) where .M = i32 {}
  18. impl i32 as Z where .N = i32 {}
  19. fn F[A:! Z](a: A) -> A { return a; }
  20. fn Main() -> i32 {
  21. return F(0);
  22. }
  23. // CHECK:STDOUT: result: 0