nondependent_where.carbon 497 B

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