fail_todo_field_initializer.carbon 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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_field_initializer.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_field_initializer.carbon
  10. class Class {
  11. // CHECK:STDERR: fail_todo_field_initializer.carbon:[[@LINE+4]]:3: error: semantics TODO: `Field initializer` [SemanticsTodo]
  12. // CHECK:STDERR: var field: i32 = 0;
  13. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  14. // CHECK:STDERR:
  15. var field: i32 = 0;
  16. }
  17. // CHECK:STDOUT: --- fail_todo_field_initializer.carbon
  18. // CHECK:STDOUT:
  19. // CHECK:STDOUT: constants {
  20. // CHECK:STDOUT: %Class: type = class_type @Class [concrete]
  21. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  22. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  23. // CHECK:STDOUT: %Class.elem: type = unbound_element_type %Class, %i32 [concrete]
  24. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
  25. // CHECK:STDOUT: %struct_type.field: type = struct_type {.field: %i32} [concrete]
  26. // CHECK:STDOUT: %complete_type.d48: <witness> = complete_type_witness %struct_type.field [concrete]
  27. // CHECK:STDOUT: }
  28. // CHECK:STDOUT:
  29. // CHECK:STDOUT: imports {
  30. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  31. // CHECK:STDOUT: .Int = %Core.Int
  32. // CHECK:STDOUT: import Core//prelude
  33. // CHECK:STDOUT: import Core//prelude/...
  34. // CHECK:STDOUT: }
  35. // CHECK:STDOUT: }
  36. // CHECK:STDOUT:
  37. // CHECK:STDOUT: file {
  38. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  39. // CHECK:STDOUT: .Core = imports.%Core
  40. // CHECK:STDOUT: .Class = %Class.decl
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT: %Core.import = import Core
  43. // CHECK:STDOUT: %Class.decl: type = class_decl @Class [concrete = constants.%Class] {} {}
  44. // CHECK:STDOUT: }
  45. // CHECK:STDOUT:
  46. // CHECK:STDOUT: class @Class {
  47. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  48. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  49. // CHECK:STDOUT: %.loc16: %Class.elem = field_decl field, element0 [concrete]
  50. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
  51. // CHECK:STDOUT: %struct_type.field: type = struct_type {.field: %i32} [concrete = constants.%struct_type.field]
  52. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.field [concrete = constants.%complete_type.d48]
  53. // CHECK:STDOUT: complete_type_witness = %complete_type
  54. // CHECK:STDOUT:
  55. // CHECK:STDOUT: !members:
  56. // CHECK:STDOUT: .Self = constants.%Class
  57. // CHECK:STDOUT: .field = %.loc16
  58. // CHECK:STDOUT: }
  59. // CHECK:STDOUT: