deducible_parameter.carbon 484 B

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