fail_different_value.carbon 675 B

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