fail_todo_local_class.carbon 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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: %.3: <witness> = complete_type_witness %.2 [template]
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT:
  38. // CHECK:STDOUT: file {}
  39. // CHECK:STDOUT:
  40. // CHECK:STDOUT: class @A {
  41. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
  42. // CHECK:STDOUT: %.loc27: <witness> = complete_type_witness %.2 [template = constants.%.3]
  43. // CHECK:STDOUT:
  44. // CHECK:STDOUT: !members:
  45. // CHECK:STDOUT: .Self = constants.%A
  46. // CHECK:STDOUT: .F = %F.decl
  47. // CHECK:STDOUT: }
  48. // CHECK:STDOUT:
  49. // CHECK:STDOUT: fn @F() {
  50. // CHECK:STDOUT: !entry:
  51. // CHECK:STDOUT: }
  52. // CHECK:STDOUT: