nondependent_where.carbon 551 B

12345678910111213141516171819202122
  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: 1
  9. package ExplorerTest api;
  10. interface A { fn Get() -> Self; }
  11. impl i32 as A { fn Get() -> Self { return 1; } }
  12. alias AlsoA = A where i32 impls A and 4 == 4;
  13. fn F[T:! AlsoA](x: T) -> T { return T.Get(); }
  14. fn Main() -> i32 {
  15. var z: i32 = 0;
  16. return F(z);
  17. }