fail_intrinsic_no_convert.carbon 708 B

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