fail_multiple_deduction.carbon 1.1 KB

123456789101112131415161718192021222324252627
  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. // RUN: %{not} %{explorer} %s 2>&1 | \
  6. // RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
  7. // RUN: %{not} %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
  8. // RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
  9. // AUTOUPDATE: %{explorer} %s
  10. package ExplorerTest api;
  11. interface HasThreeTypes {
  12. let A:! Type;
  13. let B:! Type;
  14. let C:! Type;
  15. fn Make[me: Self]() -> (A, B, C);
  16. }
  17. fn F[T:! Type](x: (T, T, T));
  18. fn G[X:! HasThreeTypes where .A == .B and .B == .C and .C == .A](x: X) {
  19. // CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/assoc_const/fail_multiple_deduction.carbon:[[@LINE+3]]: deduced multiple different values for T:! Type:
  20. // CHECK: (X:! HasThreeTypes where .Self.A == .Self.B and .Self.B == .Self.C and .Self.C == .Self.A).A
  21. // CHECK: (X:! HasThreeTypes where .Self.A == .Self.B and .Self.B == .Self.C and .Self.C == .Self.A).B
  22. F(x.Make());
  23. }
  24. fn Main() -> i32 { return 0; }