fail_builtins.carbon 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 [AliasRequiresNameRef]
  11. // CHECK:STDERR: alias a = i32;
  12. // CHECK:STDERR: ^~~
  13. // CHECK:STDERR:
  14. alias a = i32;
  15. // CHECK:STDERR: fail_builtins.carbon:[[@LINE+4]]:11: error: alias initializer must be a name reference [AliasRequiresNameRef]
  16. // CHECK:STDERR: alias b = bool;
  17. // CHECK:STDERR: ^~~~
  18. // CHECK:STDERR:
  19. alias b = bool;
  20. // CHECK:STDOUT: --- fail_builtins.carbon
  21. // CHECK:STDOUT:
  22. // CHECK:STDOUT: constants {
  23. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  24. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [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: .Int = %Core.Int
  32. // CHECK:STDOUT: .Bool = %Core.Bool
  33. // CHECK:STDOUT: import Core//prelude
  34. // CHECK:STDOUT: import Core//prelude/...
  35. // CHECK:STDOUT: }
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT:
  38. // CHECK:STDOUT: file {
  39. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  40. // CHECK:STDOUT: .Core = imports.%Core
  41. // CHECK:STDOUT: .a = %a
  42. // CHECK:STDOUT: .b = %b
  43. // CHECK:STDOUT: }
  44. // CHECK:STDOUT: %Core.import = import Core
  45. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  46. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  47. // CHECK:STDOUT: %a: <error> = bind_alias a, <error> [template = <error>]
  48. // CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
  49. // CHECK:STDOUT: %b: <error> = bind_alias b, <error> [template = <error>]
  50. // CHECK:STDOUT: }
  51. // CHECK:STDOUT: