fail_use_in_init.carbon 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. fn F() {
  7. // CHECK:STDERR: fail_use_in_init.carbon:[[@LINE+3]]:16: ERROR: Name `a` not found.
  8. // CHECK:STDERR: let a: i32 = a;
  9. // CHECK:STDERR: ^
  10. let a: i32 = a;
  11. }
  12. // CHECK:STDOUT: --- fail_use_in_init.carbon
  13. // CHECK:STDOUT:
  14. // CHECK:STDOUT: constants {
  15. // CHECK:STDOUT: %F: type = fn_type @F [template]
  16. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  17. // CHECK:STDOUT: %struct: F = struct_value () [template]
  18. // CHECK:STDOUT: }
  19. // CHECK:STDOUT:
  20. // CHECK:STDOUT: file {
  21. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  22. // CHECK:STDOUT: .Core = %Core
  23. // CHECK:STDOUT: .F = %F.decl
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  26. // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {}
  27. // CHECK:STDOUT: }
  28. // CHECK:STDOUT:
  29. // CHECK:STDOUT: fn @F() {
  30. // CHECK:STDOUT: !entry:
  31. // CHECK:STDOUT: %a.ref: <error> = name_ref a, <error> [template = <error>]
  32. // CHECK:STDOUT: %a: i32 = bind_name a, <error>
  33. // CHECK:STDOUT: return
  34. // CHECK:STDOUT: }
  35. // CHECK:STDOUT: