fail_different_value.carbon 739 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: %{explorer} %s
  6. // RUN: %{not} %{explorer-run}
  7. // RUN: %{not} %{explorer-run-trace}
  8. package ExplorerTest api;
  9. interface Iface {
  10. let N:! i32;
  11. }
  12. fn F(T:! Iface where .N == 5) {}
  13. class Good {}
  14. class Bad {}
  15. external impl Good as Iface where .N = 5 {}
  16. external impl Bad as Iface where .N = 4 {}
  17. fn Main() -> i32 {
  18. F(Good);
  19. // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/assoc_const/fail_different_value.carbon:[[@LINE+1]]: constraint requires that 4 == 5, which is not known to be true
  20. F(Bad);
  21. return 0;
  22. }