fail_param_interface_in_impl.carbon 724 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 Similar(T:! type) {}
  8. impl forall [T:! type] T as Similar(T) {}
  9. impl forall [T:! type] i32 as Similar(T) {}
  10. fn CheckSimilar[T:! type, U:! Similar(T)](a: T, b: U) {}
  11. fn Main() -> i32 {
  12. let n: i32 = 0;
  13. CheckSimilar(true, false);
  14. CheckSimilar(true, n);
  15. // 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
  16. CheckSimilar(n, false);
  17. return 0;
  18. }