empty.carbon 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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/impl/empty.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/empty.carbon
  10. interface Empty {
  11. }
  12. impl i32 as Empty {
  13. }
  14. // CHECK:STDOUT: --- empty.carbon
  15. // CHECK:STDOUT:
  16. // CHECK:STDOUT: constants {
  17. // CHECK:STDOUT: %.1: type = interface_type @Empty [template]
  18. // CHECK:STDOUT: %Self: %.1 = bind_symbolic_name Self, 0 [symbolic]
  19. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  20. // CHECK:STDOUT: %.2: type = tuple_type () [template]
  21. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  22. // CHECK:STDOUT: %.3: <witness> = interface_witness () [template]
  23. // CHECK:STDOUT: }
  24. // CHECK:STDOUT:
  25. // CHECK:STDOUT: imports {
  26. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  27. // CHECK:STDOUT: .Int32 = %import_ref
  28. // CHECK:STDOUT: import Core//prelude
  29. // CHECK:STDOUT: import Core//prelude/operators
  30. // CHECK:STDOUT: import Core//prelude/types
  31. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  32. // CHECK:STDOUT: import Core//prelude/operators/as
  33. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  34. // CHECK:STDOUT: import Core//prelude/operators/comparison
  35. // CHECK:STDOUT: import Core//prelude/types/bool
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+4, loaded [template = constants.%Int32]
  38. // CHECK:STDOUT: }
  39. // CHECK:STDOUT:
  40. // CHECK:STDOUT: file {
  41. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  42. // CHECK:STDOUT: .Core = imports.%Core
  43. // CHECK:STDOUT: .Empty = %Empty.decl
  44. // CHECK:STDOUT: }
  45. // CHECK:STDOUT: %Core.import = import Core
  46. // CHECK:STDOUT: %Empty.decl: type = interface_decl @Empty [template = constants.%.1] {} {}
  47. // CHECK:STDOUT: impl_decl @impl [template] {} {
  48. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  49. // CHECK:STDOUT: %.loc14_6.1: type = value_of_initializer %int.make_type_32 [template = i32]
  50. // CHECK:STDOUT: %.loc14_6.2: type = converted %int.make_type_32, %.loc14_6.1 [template = i32]
  51. // CHECK:STDOUT: %Empty.ref: type = name_ref Empty, file.%Empty.decl [template = constants.%.1]
  52. // CHECK:STDOUT: }
  53. // CHECK:STDOUT: }
  54. // CHECK:STDOUT:
  55. // CHECK:STDOUT: interface @Empty {
  56. // CHECK:STDOUT: %Self: %.1 = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  57. // CHECK:STDOUT:
  58. // CHECK:STDOUT: !members:
  59. // CHECK:STDOUT: .Self = %Self
  60. // CHECK:STDOUT: witness = ()
  61. // CHECK:STDOUT: }
  62. // CHECK:STDOUT:
  63. // CHECK:STDOUT: impl @impl: %.loc14_6.2 as %Empty.ref {
  64. // CHECK:STDOUT: %.loc14_19: <witness> = interface_witness () [template = constants.%.3]
  65. // CHECK:STDOUT:
  66. // CHECK:STDOUT: !members:
  67. // CHECK:STDOUT: witness = %.loc14_19
  68. // CHECK:STDOUT: }
  69. // CHECK:STDOUT:
  70. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  71. // CHECK:STDOUT: