fail_out_of_line_decl.carbon 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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/class/fail_out_of_line_decl.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_out_of_line_decl.carbon
  10. class C {}
  11. // CHECK:STDERR: fail_out_of_line_decl.carbon:[[@LINE+3]]:6: ERROR: Out-of-line declaration requires a declaration in scoped entity.
  12. // CHECK:STDERR: fn C.F() {}
  13. // CHECK:STDERR: ^
  14. fn C.F() {}
  15. // CHECK:STDOUT: --- fail_out_of_line_decl.carbon
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: constants {
  18. // CHECK:STDOUT: %C: type = class_type @C [template]
  19. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  20. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  21. // CHECK:STDOUT: %.2: type = tuple_type () [template]
  22. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  23. // CHECK:STDOUT: }
  24. // CHECK:STDOUT:
  25. // CHECK:STDOUT: file {
  26. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  27. // CHECK:STDOUT: .Core = %Core
  28. // CHECK:STDOUT: .C = %C.decl
  29. // CHECK:STDOUT: }
  30. // CHECK:STDOUT: %Core.import = import Core
  31. // CHECK:STDOUT: %Core: <namespace> = namespace %Core.import, [template] {
  32. // CHECK:STDOUT: import Core//prelude
  33. // CHECK:STDOUT: import Core//prelude/operators
  34. // CHECK:STDOUT: import Core//prelude/types
  35. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  36. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  37. // CHECK:STDOUT: import Core//prelude/operators/comparison
  38. // CHECK:STDOUT: import Core//prelude/types/bool
  39. // CHECK:STDOUT: }
  40. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
  41. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {}
  42. // CHECK:STDOUT: }
  43. // CHECK:STDOUT:
  44. // CHECK:STDOUT: class @C {
  45. // CHECK:STDOUT: !members:
  46. // CHECK:STDOUT: .Self = constants.%C
  47. // CHECK:STDOUT: .F = file.%F.decl
  48. // CHECK:STDOUT: }
  49. // CHECK:STDOUT:
  50. // CHECK:STDOUT: fn @F() {
  51. // CHECK:STDOUT: !entry:
  52. // CHECK:STDOUT: return
  53. // CHECK:STDOUT: }
  54. // CHECK:STDOUT: