fail_todo_control_flow_init.carbon 4.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. // CHECK:STDERR: fail_todo_control_flow_init.carbon:[[@LINE+12]]:13: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`.
  7. // CHECK:STDERR: var x: () = if true then () else ();
  8. // CHECK:STDERR: ^~~~~~~
  9. // CHECK:STDERR:
  10. // CHECK:STDERR: fail_todo_control_flow_init.carbon:[[@LINE+8]]:13: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`.
  11. // CHECK:STDERR: var x: () = if true then () else ();
  12. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
  13. // CHECK:STDERR:
  14. // CHECK:STDERR: fail_todo_control_flow_init.carbon:[[@LINE+4]]:21: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`.
  15. // CHECK:STDERR: var x: () = if true then () else ();
  16. // CHECK:STDERR: ^~~~~~~
  17. // CHECK:STDERR:
  18. var x: () = if true then () else ();
  19. // CHECK:STDERR: fail_todo_control_flow_init.carbon:[[@LINE+12]]:14: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`.
  20. // CHECK:STDERR: var x2: () = if false then () else ();
  21. // CHECK:STDERR: ^~~~~~~~
  22. // CHECK:STDERR:
  23. // CHECK:STDERR: fail_todo_control_flow_init.carbon:[[@LINE+8]]:14: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`.
  24. // CHECK:STDERR: var x2: () = if false then () else ();
  25. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
  26. // CHECK:STDERR:
  27. // CHECK:STDERR: fail_todo_control_flow_init.carbon:[[@LINE+4]]:23: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`.
  28. // CHECK:STDERR: var x2: () = if false then () else ();
  29. // CHECK:STDERR: ^~~~~~~
  30. // CHECK:STDERR:
  31. var x2: () = if false then () else ();
  32. // CHECK:STDERR: fail_todo_control_flow_init.carbon:[[@LINE+8]]:15: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`.
  33. // CHECK:STDERR: var y: bool = true or false;
  34. // CHECK:STDERR: ^~~~~~~
  35. // CHECK:STDERR:
  36. // CHECK:STDERR: fail_todo_control_flow_init.carbon:[[@LINE+4]]:15: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`.
  37. // CHECK:STDERR: var y: bool = true or false;
  38. // CHECK:STDERR: ^~~~~~~~~~~~~
  39. // CHECK:STDERR:
  40. var y: bool = true or false;
  41. // CHECK:STDERR: fail_todo_control_flow_init.carbon:[[@LINE+7]]:16: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`.
  42. // CHECK:STDERR: var y2: bool = false or true;
  43. // CHECK:STDERR: ^~~~~~~~
  44. // CHECK:STDERR:
  45. // CHECK:STDERR: fail_todo_control_flow_init.carbon:[[@LINE+3]]:16: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`.
  46. // CHECK:STDERR: var y2: bool = false or true;
  47. // CHECK:STDERR: ^~~~~~~~~~~~~
  48. var y2: bool = false or true;
  49. // CHECK:STDOUT: --- fail_todo_control_flow_init.carbon
  50. // CHECK:STDOUT:
  51. // CHECK:STDOUT: constants {
  52. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  53. // CHECK:STDOUT: %.2: bool = bool_literal true [template]
  54. // CHECK:STDOUT: %tuple: () = tuple_value () [template]
  55. // CHECK:STDOUT: %.3: bool = bool_literal false [template]
  56. // CHECK:STDOUT: }
  57. // CHECK:STDOUT:
  58. // CHECK:STDOUT: file {
  59. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  60. // CHECK:STDOUT: .Core = %Core
  61. // CHECK:STDOUT: .x = %x
  62. // CHECK:STDOUT: .x2 = %x2
  63. // CHECK:STDOUT: .y = %y
  64. // CHECK:STDOUT: .y2 = %y2
  65. // CHECK:STDOUT: }
  66. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  67. // CHECK:STDOUT: %.loc19_9.1: () = tuple_literal ()
  68. // CHECK:STDOUT: %.loc19_9.2: type = converted %.loc19_9.1, constants.%.1 [template = constants.%.1]
  69. // CHECK:STDOUT: %x.var: ref () = var x
  70. // CHECK:STDOUT: %x: ref () = bind_name x, %x.var
  71. // CHECK:STDOUT: %.loc33_10.1: () = tuple_literal ()
  72. // CHECK:STDOUT: %.loc33_10.2: type = converted %.loc33_10.1, constants.%.1 [template = constants.%.1]
  73. // CHECK:STDOUT: %x2.var: ref () = var x2
  74. // CHECK:STDOUT: %x2: ref () = bind_name x2, %x2.var
  75. // CHECK:STDOUT: %y.var: ref bool = var y
  76. // CHECK:STDOUT: %y: ref bool = bind_name y, %y.var
  77. // CHECK:STDOUT: %y2.var: ref bool = var y2
  78. // CHECK:STDOUT: %y2: ref bool = bind_name y2, %y2.var
  79. // CHECK:STDOUT: }
  80. // CHECK:STDOUT:
  81. // CHECK:STDOUT: fn @__global_init() {
  82. // CHECK:STDOUT: !entry:
  83. // CHECK:STDOUT: %.loc19: bool = bool_literal true [template = constants.%.2]
  84. // CHECK:STDOUT: if %.loc19 br !if.expr.then else br !if.expr.else
  85. // CHECK:STDOUT: }
  86. // CHECK:STDOUT: