fail_qualifier_unsupported.carbon 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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.
  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: %Int32.type: type = fn_type @Int32 [template]
  19. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  20. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  21. // CHECK:STDOUT: }
  22. // CHECK:STDOUT:
  23. // CHECK:STDOUT: imports {
  24. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  25. // CHECK:STDOUT: .Int32 = %import_ref
  26. // CHECK:STDOUT: import Core//prelude
  27. // CHECK:STDOUT: import Core//prelude/operators
  28. // CHECK:STDOUT: import Core//prelude/types
  29. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  30. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  31. // CHECK:STDOUT: import Core//prelude/operators/comparison
  32. // CHECK:STDOUT: import Core//prelude/types/bool
  33. // CHECK:STDOUT: }
  34. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+4, loaded [template = constants.%Int32]
  35. // CHECK:STDOUT: }
  36. // CHECK:STDOUT:
  37. // CHECK:STDOUT: file {
  38. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  39. // CHECK:STDOUT: .Core = imports.%Core
  40. // CHECK:STDOUT: .x = %x
  41. // CHECK:STDOUT: .y = %y
  42. // CHECK:STDOUT: }
  43. // CHECK:STDOUT: %Core.import = import Core
  44. // CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%Int32() [template = i32]
  45. // CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32]
  46. // CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32.loc11, %.loc11_8.1 [template = i32]
  47. // CHECK:STDOUT: %x.var: ref i32 = var x
  48. // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var
  49. // CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%Int32() [template = i32]
  50. // CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32]
  51. // CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32]
  52. // CHECK:STDOUT: %y.var: ref i32 = var y
  53. // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.var
  54. // CHECK:STDOUT: }
  55. // CHECK:STDOUT:
  56. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  57. // CHECK:STDOUT:
  58. // CHECK:STDOUT: fn @__global_init() {
  59. // CHECK:STDOUT: !entry:
  60. // CHECK:STDOUT: %x.ref: ref i32 = name_ref x, file.%x
  61. // CHECK:STDOUT: assign file.%y.var, <error>
  62. // CHECK:STDOUT: return
  63. // CHECK:STDOUT: }
  64. // CHECK:STDOUT: