rewrite_compound.carbon 617 B

12345678910111213141516171819202122232425262728
  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 HasAssoc {
  9. let Assoc:! type;
  10. }
  11. class X {
  12. external impl as HasAssoc where .Assoc = i32 {}
  13. }
  14. alias WithoutRewrite = HasAssoc where .Assoc == i32;
  15. alias WithRewrite = HasAssoc where .Assoc = i32;
  16. fn F[T:! WithRewrite](x: T) -> i32 {
  17. var a: T.(WithoutRewrite.Assoc) = 1;
  18. return a;
  19. }
  20. fn Main() -> i32 {
  21. var x: X = {};
  22. return F(x);
  23. }