fail_extend_non_interface.carbon 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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_extend_non_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_extend_non_interface.carbon
  10. class C {
  11. // CHECK:STDERR: fail_extend_non_interface.carbon:[[@LINE+3]]:3: error: semantics TODO: `extending non-facet-type constraint` [SemanticsTodo]
  12. // CHECK:STDERR: extend impl as i32;
  13. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  14. extend impl as i32;
  15. }
  16. // CHECK:STDOUT: --- fail_extend_non_interface.carbon
  17. // CHECK:STDOUT:
  18. // CHECK:STDOUT: constants {
  19. // CHECK:STDOUT: %C: type = class_type @C [template]
  20. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  21. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  22. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  23. // CHECK:STDOUT: %complete_type.2: <witness> = complete_type_witness %empty_struct_type [template]
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT:
  26. // CHECK:STDOUT: imports {
  27. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  28. // CHECK:STDOUT: .Int = %import_ref.1
  29. // CHECK:STDOUT: import Core//prelude
  30. // CHECK:STDOUT: import Core//prelude/...
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT:
  34. // CHECK:STDOUT: file {
  35. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  36. // CHECK:STDOUT: .Core = imports.%Core
  37. // CHECK:STDOUT: .C = %C.decl
  38. // CHECK:STDOUT: }
  39. // CHECK:STDOUT: %Core.import = import Core
  40. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT:
  43. // CHECK:STDOUT: impl @impl: %Self.ref as %i32;
  44. // CHECK:STDOUT:
  45. // CHECK:STDOUT: class @C {
  46. // CHECK:STDOUT: impl_decl @impl [template] {} {
  47. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C]
  48. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  49. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  50. // CHECK:STDOUT: }
  51. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.2]
  52. // CHECK:STDOUT:
  53. // CHECK:STDOUT: !members:
  54. // CHECK:STDOUT: .Self = constants.%C
  55. // CHECK:STDOUT: has_error
  56. // CHECK:STDOUT: complete_type_witness = %complete_type
  57. // CHECK:STDOUT: }
  58. // CHECK:STDOUT: