fail_name_not_found.carbon 1.5 KB

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