fail_indirectly_equal.carbon 872 B

12345678910111213141516171819202122232425262728293031323334
  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. // RUN: %{not} %{explorer-run}
  7. // RUN: %{not} %{explorer-run-trace}
  8. package ExplorerTest api;
  9. interface A {
  10. let T:! type;
  11. }
  12. fn F1[T:! A where .T == i32](x: T.T) -> i32 {
  13. // OK: one equality.
  14. return x;
  15. }
  16. fn F2[U:! A where .T == i32](x: i32) -> U.T {
  17. // OK: one equality.
  18. return x;
  19. }
  20. fn F3[T:! A where .T == i32, U:! A where .T == i32](x: T.T) -> U.T {
  21. // 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)'
  22. return x;
  23. }
  24. external impl i32 as A where .T == i32 {}
  25. fn Main() -> i32 {
  26. return F3(0);
  27. }