impl_used_by_later_rewrite.carbon 724 B

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