fail_extend_non_interface.carbon 3.1 KB

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