impl_used_by_later_rewrite.carbon 676 B

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