rewrite_compound.carbon 611 B

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