error_recovery.carbon 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  6. // EXTRA-ARGS: --no-prelude-import --dump-sem-ir-ranges=if-present
  7. //
  8. // AUTOUPDATE
  9. // TIP: To test this file alone, run:
  10. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/error_recovery.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/error_recovery.carbon
  13. // --- fail_fuzz_crash.carbon
  14. class C {}
  15. interface I {}
  16. // CHECK:STDERR: fail_fuzz_crash.carbon:[[@LINE+4]]:14: error: parameters of generic types must be constant [GenericParamMustBeConstant]
  17. // CHECK:STDERR: impl forall [T: type] C as I { }
  18. // CHECK:STDERR: ^~~~~~~
  19. // CHECK:STDERR:
  20. impl forall [T: type] C as I { }
  21. // CHECK:STDOUT: --- fail_fuzz_crash.carbon
  22. // CHECK:STDOUT:
  23. // CHECK:STDOUT: constants {
  24. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  25. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  26. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  27. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  28. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  29. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table [concrete]
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT:
  32. // CHECK:STDOUT: file {
  33. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  34. // CHECK:STDOUT: .C = %C.decl
  35. // CHECK:STDOUT: .I = %I.decl
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  38. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  39. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  40. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  41. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  42. // CHECK:STDOUT: }
  43. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @impl [concrete]
  44. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  45. // CHECK:STDOUT: }
  46. // CHECK:STDOUT:
  47. // CHECK:STDOUT: interface @I {
  48. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  49. // CHECK:STDOUT:
  50. // CHECK:STDOUT: !members:
  51. // CHECK:STDOUT: .Self = %Self
  52. // CHECK:STDOUT: witness = ()
  53. // CHECK:STDOUT: }
  54. // CHECK:STDOUT:
  55. // CHECK:STDOUT: impl @impl: %C.ref as %I.ref {
  56. // CHECK:STDOUT: !members:
  57. // CHECK:STDOUT: witness = file.%I.impl_witness
  58. // CHECK:STDOUT: }
  59. // CHECK:STDOUT:
  60. // CHECK:STDOUT: class @C {
  61. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  62. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  63. // CHECK:STDOUT: complete_type_witness = %complete_type
  64. // CHECK:STDOUT:
  65. // CHECK:STDOUT: !members:
  66. // CHECK:STDOUT: .Self = constants.%C
  67. // CHECK:STDOUT: }
  68. // CHECK:STDOUT: