fail_not_found.carbon 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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/package_expr/fail_not_found.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/package_expr/fail_not_found.carbon
  10. fn Main() {
  11. // CHECK:STDERR: fail_not_found.carbon:[[@LINE+3]]:16: ERROR: Name `x` not found.
  12. // CHECK:STDERR: var y: i32 = package.x;
  13. // CHECK:STDERR: ^~~~~~~~~
  14. var y: i32 = package.x;
  15. }
  16. // CHECK:STDOUT: --- fail_not_found.carbon
  17. // CHECK:STDOUT:
  18. // CHECK:STDOUT: constants {
  19. // CHECK:STDOUT: %Main.type: type = fn_type @Main [template]
  20. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  21. // CHECK:STDOUT: %Main: %Main.type = struct_value () [template]
  22. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  23. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT:
  26. // CHECK:STDOUT: file {
  27. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  28. // CHECK:STDOUT: .Core = %Core
  29. // CHECK:STDOUT: .Main = %Main.decl
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  32. // CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [template = constants.%Main] {}
  33. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
  34. // CHECK:STDOUT: }
  35. // CHECK:STDOUT:
  36. // CHECK:STDOUT: fn @Main() {
  37. // CHECK:STDOUT: !entry:
  38. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  39. // CHECK:STDOUT: %.loc15_10.1: type = value_of_initializer %int.make_type_32 [template = i32]
  40. // CHECK:STDOUT: %.loc15_10.2: type = converted %int.make_type_32, %.loc15_10.1 [template = i32]
  41. // CHECK:STDOUT: %y.var: ref i32 = var y
  42. // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.var
  43. // CHECK:STDOUT: %package.ref: <namespace> = name_ref package, package [template = package]
  44. // CHECK:STDOUT: %x.ref: <error> = name_ref x, <error> [template = <error>]
  45. // CHECK:STDOUT: assign %y.var, <error>
  46. // CHECK:STDOUT: return
  47. // CHECK:STDOUT: }
  48. // CHECK:STDOUT:
  49. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  50. // CHECK:STDOUT: