fail_builtins.carbon 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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/alias/fail_builtins.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/fail_builtins.carbon
  10. // CHECK:STDERR: fail_builtins.carbon:[[@LINE+4]]:11: error: alias initializer must be a name reference
  11. // CHECK:STDERR: alias a = i32;
  12. // CHECK:STDERR: ^~~
  13. // CHECK:STDERR:
  14. alias a = i32;
  15. // CHECK:STDERR: fail_builtins.carbon:[[@LINE+3]]:11: error: alias initializer must be a name reference
  16. // CHECK:STDERR: alias b = bool;
  17. // CHECK:STDERR: ^~~~
  18. alias b = bool;
  19. // CHECK:STDOUT: --- fail_builtins.carbon
  20. // CHECK:STDOUT:
  21. // CHECK:STDOUT: constants {
  22. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  23. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  24. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  25. // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [template]
  26. // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [template]
  27. // CHECK:STDOUT: }
  28. // CHECK:STDOUT:
  29. // CHECK:STDOUT: imports {
  30. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  31. // CHECK:STDOUT: .Int32 = %import_ref.1
  32. // CHECK:STDOUT: .Bool = %import_ref.2
  33. // CHECK:STDOUT: import Core//prelude
  34. // CHECK:STDOUT: import Core//prelude/operators
  35. // CHECK:STDOUT: import Core//prelude/types
  36. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  37. // CHECK:STDOUT: import Core//prelude/operators/as
  38. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  39. // CHECK:STDOUT: import Core//prelude/operators/comparison
  40. // CHECK:STDOUT: import Core//prelude/types/bool
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT: %import_ref.1: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
  43. // CHECK:STDOUT: %import_ref.2: %Bool.type = import_ref Core//prelude/types/bool, inst+2, loaded [template = constants.%Bool]
  44. // CHECK:STDOUT: }
  45. // CHECK:STDOUT:
  46. // CHECK:STDOUT: file {
  47. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  48. // CHECK:STDOUT: .Core = imports.%Core
  49. // CHECK:STDOUT: .a = %a
  50. // CHECK:STDOUT: .b = %b
  51. // CHECK:STDOUT: }
  52. // CHECK:STDOUT: %Core.import = import Core
  53. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  54. // CHECK:STDOUT: %a: <error> = bind_alias a, <error> [template = <error>]
  55. // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
  56. // CHECK:STDOUT: %b: <error> = bind_alias b, <error> [template = <error>]
  57. // CHECK:STDOUT: }
  58. // CHECK:STDOUT:
  59. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  60. // CHECK:STDOUT:
  61. // CHECK:STDOUT: fn @Bool() -> type = "bool.make_type";
  62. // CHECK:STDOUT: