fail_qualifier_unsupported.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/basics/fail_qualifier_unsupported.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_qualifier_unsupported.carbon
  10. var x: i32;
  11. // CHECK:STDERR: fail_qualifier_unsupported.carbon:[[@LINE+3]]:14: error: type `i32` does not support qualified expressions [QualifiedExprUnsupported]
  12. // CHECK:STDERR: var y: i32 = x.b;
  13. // CHECK:STDERR: ^~~
  14. var y: i32 = x.b;
  15. // CHECK:STDOUT: --- fail_qualifier_unsupported.carbon
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: constants {
  18. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 32 [template]
  19. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  20. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  21. // CHECK:STDOUT: %i32: type = int_type signed, %.1 [template]
  22. // CHECK:STDOUT: }
  23. // CHECK:STDOUT:
  24. // CHECK:STDOUT: imports {
  25. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  26. // CHECK:STDOUT: .Int = %import_ref
  27. // CHECK:STDOUT: import Core//prelude
  28. // CHECK:STDOUT: import Core//prelude/...
  29. // CHECK:STDOUT: }
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT:
  32. // CHECK:STDOUT: file {
  33. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  34. // CHECK:STDOUT: .Core = imports.%Core
  35. // CHECK:STDOUT: .x = %x
  36. // CHECK:STDOUT: .y = %y
  37. // CHECK:STDOUT: }
  38. // CHECK:STDOUT: %Core.import = import Core
  39. // CHECK:STDOUT: %.loc11_8.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  40. // CHECK:STDOUT: %int.make_type_signed.loc11: init type = call constants.%Int(%.loc11_8.1) [template = constants.%i32]
  41. // CHECK:STDOUT: %.loc11_8.2: type = value_of_initializer %int.make_type_signed.loc11 [template = constants.%i32]
  42. // CHECK:STDOUT: %.loc11_8.3: type = converted %int.make_type_signed.loc11, %.loc11_8.2 [template = constants.%i32]
  43. // CHECK:STDOUT: %x.var: ref %i32 = var x
  44. // CHECK:STDOUT: %x: ref %i32 = bind_name x, %x.var
  45. // CHECK:STDOUT: %.loc15_8.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  46. // CHECK:STDOUT: %int.make_type_signed.loc15: init type = call constants.%Int(%.loc15_8.1) [template = constants.%i32]
  47. // CHECK:STDOUT: %.loc15_8.2: type = value_of_initializer %int.make_type_signed.loc15 [template = constants.%i32]
  48. // CHECK:STDOUT: %.loc15_8.3: type = converted %int.make_type_signed.loc15, %.loc15_8.2 [template = constants.%i32]
  49. // CHECK:STDOUT: %y.var: ref %i32 = var y
  50. // CHECK:STDOUT: %y: ref %i32 = bind_name y, %y.var
  51. // CHECK:STDOUT: }
  52. // CHECK:STDOUT:
  53. // CHECK:STDOUT: fn @__global_init() {
  54. // CHECK:STDOUT: !entry:
  55. // CHECK:STDOUT: %x.ref: ref %i32 = name_ref x, file.%x
  56. // CHECK:STDOUT: assign file.%y.var, <error>
  57. // CHECK:STDOUT: return
  58. // CHECK:STDOUT: }
  59. // CHECK:STDOUT: