instantiate_deduced.carbon 467 B

123456789101112131415161718192021
  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. fn ReturnIndirectly[T:! type](direct: bool, x: T) -> type {
  8. if (direct) {
  9. return T;
  10. } else {
  11. return ReturnIndirectly(true, x);
  12. }
  13. }
  14. fn Main() -> ReturnIndirectly(false, 0) {
  15. return 0;
  16. }
  17. // CHECK:STDOUT: result: 0