fail_intrinsic_no_convert.carbon 801 B

123456789101112131415161718192021222324
  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. class ConvertTo(T:! type) {
  10. var v: T;
  11. impl as ImplicitAs(T) {
  12. fn Convert[self: Self]() -> T { return self.v; }
  13. }
  14. }
  15. fn Main() -> i32 {
  16. // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/assert/fail_intrinsic_no_convert.carbon:[[@LINE+3]]: type error in __intrinsic_assert argument 0
  17. // CHECK:STDERR: expected: bool
  18. // CHECK:STDERR: actual: class ConvertTo(T = bool)
  19. __intrinsic_assert({.v = true} as ConvertTo(bool), {.v = "Pass"} as ConvertTo(String));
  20. return 0;
  21. }