fail_indirectly_equal.carbon 797 B

1234567891011121314151617181920212223242526272829303132
  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 A {
  8. let T:! type;
  9. }
  10. fn F1[T:! A where .T == i32](x: T.T) -> i32 {
  11. // OK: one equality.
  12. return x;
  13. }
  14. fn F2[U:! A where .T == i32](x: i32) -> U.T {
  15. // OK: one equality.
  16. return x;
  17. }
  18. fn F3[T:! A where .T == i32, U:! A where .T == i32](x: T.T) -> U.T {
  19. // CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_indirectly_equal.carbon:[[@LINE+1]]: type error in return value: '(T).(A.T)' is not implicitly convertible to '(U).(A.T)'
  20. return x;
  21. }
  22. external impl i32 as A where .T == i32 {}
  23. fn Main() -> i32 {
  24. return F3(0);
  25. }