deducible_parameter.carbon 492 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. // CHECK:STDOUT: result: 1
  7. package ExplorerTest api;
  8. interface A(T:! type) {}
  9. interface B {
  10. fn F() -> i32;
  11. }
  12. class C(T:! type) {}
  13. external impl forall [T:! type] C(T) as A(T) & B {
  14. fn F() -> i32 { return 1; }
  15. }
  16. fn Main() -> i32 {
  17. var v: C(i32) = {};
  18. return v.(B.F)();
  19. }