fail_unknown_value.carbon 775 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. // RUN: %{not} %{explorer} %s 2>&1 | %{FileCheck-strict} %s
  6. // RUN: %{not} %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
  7. // AUTOUPDATE: %{explorer} %s
  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: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. }