fail_unknown_value.carbon 699 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. // RUN: %{not} %{explorer-run}
  7. // RUN: %{not} %{explorer-run-trace}
  8. package ExplorerTest api;
  9. interface Iface { let N:! i32; }
  10. fn PickType(N: i32) -> type { return i32; }
  11. fn F[T:! Iface](x: T) -> i32 {
  12. // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/assoc_const/fail_unknown_value.carbon:[[@LINE+1]]: value of associated constant (T).(Iface.N) is not known
  13. var x: PickType(T.N) = 0;
  14. return x;
  15. }
  16. impl i32 as Iface where .N = 5 {}
  17. fn Main() -> i32 {
  18. return F(0);
  19. }