use_at_compile_time.carbon 514 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 Has(T:! type) {
  8. fn Get() -> T;
  9. }
  10. impl i32 as Has(type) {
  11. fn Get() -> type { return Self; }
  12. }
  13. class WithType(T:! Has(type)) {
  14. fn Get() -> type { return T.Get(); }
  15. }
  16. fn Main() -> i32 {
  17. var v: WithType(i32).Get() = 0;
  18. return v;
  19. }
  20. // CHECK:STDOUT: result: 0