fail_impl_bad_interface.carbon 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/fail_impl_bad_interface.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_impl_bad_interface.carbon
  10. // CHECK:STDERR: fail_impl_bad_interface.carbon:[[@LINE+7]]:1: ERROR: Semantics TODO: `impl as non-interface`.
  11. // CHECK:STDERR: impl i32 as false {}
  12. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  13. // CHECK:STDERR:
  14. // CHECK:STDERR: fail_impl_bad_interface.carbon:[[@LINE+3]]:13: ERROR: Cannot implicitly convert from `bool` to `type`.
  15. // CHECK:STDERR: impl i32 as false {}
  16. // CHECK:STDERR: ^~~~~
  17. impl i32 as false {}
  18. // CHECK:STDOUT: --- fail_impl_bad_interface.carbon
  19. // CHECK:STDOUT:
  20. // CHECK:STDOUT: constants {
  21. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  22. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  23. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  24. // CHECK:STDOUT: %.2: bool = bool_literal false [template]
  25. // CHECK:STDOUT: }
  26. // CHECK:STDOUT:
  27. // CHECK:STDOUT: file {
  28. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  29. // CHECK:STDOUT: .Core = %Core
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  32. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
  33. // CHECK:STDOUT: impl_decl @impl {
  34. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  35. // CHECK:STDOUT: %.loc18_6.1: type = value_of_initializer %int.make_type_32 [template = i32]
  36. // CHECK:STDOUT: %.loc18_6.2: type = converted %int.make_type_32, %.loc18_6.1 [template = i32]
  37. // CHECK:STDOUT: %.loc18_13: bool = bool_literal false [template = constants.%.2]
  38. // CHECK:STDOUT: }
  39. // CHECK:STDOUT: }
  40. // CHECK:STDOUT:
  41. // CHECK:STDOUT: impl @impl: i32 as <error> {
  42. // CHECK:STDOUT: !members:
  43. // CHECK:STDOUT: witness = <error>
  44. // CHECK:STDOUT: }
  45. // CHECK:STDOUT:
  46. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  47. // CHECK:STDOUT: