fail_unknown_value.carbon 624 B

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