associated_constant.carbon 562 B

1234567891011121314151617181920212223
  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: i32
  7. // CHECK:STDOUT: String
  8. // CHECK:STDOUT: result: 0
  9. package Testcase api;
  10. interface HasName {
  11. let Name:! String;
  12. }
  13. external impl i32 as HasName where .Name = "i32" {}
  14. external impl String as HasName where .Name = "String" {}
  15. fn Main() -> i32 {
  16. Print(i32.(HasName.Name));
  17. Print(String.(HasName.Name));
  18. return 0;
  19. }