fail_param_interface_in_impl.carbon 799 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 Similar(T:! type) {}
  10. impl forall [T:! type] T as Similar(T) {}
  11. impl forall [T:! type] i32 as Similar(T) {}
  12. fn CheckSimilar[T:! type, U:! Similar(T)](a: T, b: U) {}
  13. fn Main() -> i32 {
  14. let n: i32 = 0;
  15. CheckSimilar(true, false);
  16. CheckSimilar(true, n);
  17. // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/impl/fail_param_interface_in_impl.carbon:[[@LINE+1]]: could not find implementation of interface Similar(T = i32) for bool
  18. CheckSimilar(n, false);
  19. return 0;
  20. }