fail_todo_local_class.carbon 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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_todo_local_class.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_todo_local_class.carbon
  10. // TODO: Support parsing classes at function scope.
  11. class A {
  12. fn F() {
  13. // CHECK:STDERR: fail_todo_local_class.carbon:[[@LINE+7]]:5: ERROR: Expected expression.
  14. // CHECK:STDERR: class B {
  15. // CHECK:STDERR: ^~~~~
  16. // CHECK:STDERR:
  17. // CHECK:STDERR: fail_todo_local_class.carbon:[[@LINE+3]]:5: ERROR: Semantics TODO: `HandleInvalidParse`.
  18. // CHECK:STDERR: class B {
  19. // CHECK:STDERR: ^~~~~
  20. class B {
  21. fn G() {
  22. var b: B = {};
  23. }
  24. }
  25. }
  26. }
  27. // CHECK:STDOUT: --- fail_todo_local_class.carbon
  28. // CHECK:STDOUT:
  29. // CHECK:STDOUT: constants {
  30. // CHECK:STDOUT: %A: type = class_type @A [template]
  31. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  32. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  33. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  34. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  35. // CHECK:STDOUT: }
  36. // CHECK:STDOUT:
  37. // CHECK:STDOUT: file {}
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: class @A {
  40. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {}
  41. // CHECK:STDOUT:
  42. // CHECK:STDOUT: !members:
  43. // CHECK:STDOUT: .Self = constants.%A
  44. // CHECK:STDOUT: .F = %F.decl
  45. // CHECK:STDOUT: }
  46. // CHECK:STDOUT:
  47. // CHECK:STDOUT: fn @F() {
  48. // CHECK:STDOUT: !entry:
  49. // CHECK:STDOUT: }
  50. // CHECK:STDOUT: