fail_extend_non_interface.carbon 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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-interface constraint`
  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: %Int32.type: type = fn_type @Int32 [template]
  21. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  22. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  23. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  24. // CHECK:STDOUT: %.3: <witness> = complete_type_witness %.2 [template]
  25. // CHECK:STDOUT: }
  26. // CHECK:STDOUT:
  27. // CHECK:STDOUT: imports {
  28. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  29. // CHECK:STDOUT: .Int32 = %import_ref
  30. // CHECK:STDOUT: import Core//prelude
  31. // CHECK:STDOUT: import Core//prelude/operators
  32. // CHECK:STDOUT: import Core//prelude/types
  33. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  34. // CHECK:STDOUT: import Core//prelude/operators/as
  35. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  36. // CHECK:STDOUT: import Core//prelude/operators/comparison
  37. // CHECK:STDOUT: import Core//prelude/types/bool
  38. // CHECK:STDOUT: }
  39. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+4, loaded [template = constants.%Int32]
  40. // CHECK:STDOUT: }
  41. // CHECK:STDOUT:
  42. // CHECK:STDOUT: file {
  43. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  44. // CHECK:STDOUT: .Core = imports.%Core
  45. // CHECK:STDOUT: .C = %C.decl
  46. // CHECK:STDOUT: }
  47. // CHECK:STDOUT: %Core.import = import Core
  48. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  49. // CHECK:STDOUT: }
  50. // CHECK:STDOUT:
  51. // CHECK:STDOUT: impl @impl: %C as i32;
  52. // CHECK:STDOUT:
  53. // CHECK:STDOUT: class @C {
  54. // CHECK:STDOUT: %.loc15_18.1: type = value_of_initializer @impl.%int.make_type_32 [template = i32]
  55. // CHECK:STDOUT: %.loc15_18.2: type = converted @impl.%int.make_type_32, %.loc15_18.1 [template = i32]
  56. // CHECK:STDOUT: impl_decl @impl {} {
  57. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  58. // CHECK:STDOUT: }
  59. // CHECK:STDOUT: %.loc16: <witness> = complete_type_witness %.2 [template = constants.%.3]
  60. // CHECK:STDOUT:
  61. // CHECK:STDOUT: !members:
  62. // CHECK:STDOUT: .Self = constants.%C
  63. // CHECK:STDOUT: has_error
  64. // CHECK:STDOUT: }
  65. // CHECK:STDOUT:
  66. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  67. // CHECK:STDOUT: