nondependent_where.carbon 500 B

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