param_interface_in_impl.carbon 600 B

123456789101112131415161718192021222324
  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 Similar(T:! type) {}
  11. impl forall [T:! type] T as Similar(T) {}
  12. impl forall [T:! type] i32 as Similar(T) {}
  13. fn CheckSimilar[T:! type, U:! Similar(T)](a: T, b: U) {}
  14. fn Main() -> i32 {
  15. let n: i32 = 0;
  16. CheckSimilar(true, false);
  17. CheckSimilar(true, n);
  18. return 0;
  19. }