fail_missing_rewrite.carbon 800 B

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. // AUTOUPDATE
  6. // RUN: %{not} %{explorer-run}
  7. // RUN: %{not} %{explorer-run-trace}
  8. package ExplorerTest api;
  9. interface Container {
  10. let Element:! type;
  11. fn Front[self: Self]() -> Element;
  12. }
  13. fn A[T:! Container where .Element = i32](x: T) -> T.Element {
  14. return x.Front();
  15. }
  16. fn B[T:! Container](x: T) -> i32 {
  17. // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/assoc_const/fail_missing_rewrite.carbon:[[@LINE+1]]: constraint requires that (T).(Container.Element) (with value (T).(Container.Element)) == i32, which is not known to be true
  18. return A(x);
  19. }
  20. fn Main() -> i32 {
  21. return 0;
  22. }