simple_equality.carbon 539 B

123456789101112131415161718192021222324252627
  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. package ExplorerTest api;
  7. interface Frob {
  8. let Result:! type;
  9. fn F[self: Self]() -> Result;
  10. }
  11. fn Use[T:! Frob](x: T) -> T.Result {
  12. var v: T.Result = x.F();
  13. return v;
  14. }
  15. impl i32 as Frob where .Result = i32 {
  16. fn F[self: Self]() -> i32 { return 0; }
  17. }
  18. fn Main() -> i32 {
  19. return Use(0);
  20. }
  21. // CHECK:STDOUT: result: 0