deducible_parameter.carbon 546 B

1234567891011121314151617181920212223242526
  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(T:! type) {}
  11. interface B {
  12. fn F() -> i32;
  13. }
  14. class C(T:! type) {}
  15. external impl forall [T:! type] C(T) as A(T) & B {
  16. fn F() -> i32 { return 1; }
  17. }
  18. fn Main() -> i32 {
  19. var v: C(i32) = {};
  20. return v.(B.F)();
  21. }