import_interface_decl.carbon 2.3 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/interface/no_prelude/import_interface_decl.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/import_interface_decl.carbon
  10. // --- a.carbon
  11. library "[[@TEST_NAME]]";
  12. interface A;
  13. impl () as A;
  14. // --- a.impl.carbon
  15. impl library "[[@TEST_NAME]]";
  16. // CHECK:STDOUT: --- a.carbon
  17. // CHECK:STDOUT:
  18. // CHECK:STDOUT: constants {
  19. // CHECK:STDOUT: %.1: type = interface_type @A [template]
  20. // CHECK:STDOUT: %.2: type = tuple_type () [template]
  21. // CHECK:STDOUT: }
  22. // CHECK:STDOUT:
  23. // CHECK:STDOUT: file {
  24. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  25. // CHECK:STDOUT: .A = %A.decl
  26. // CHECK:STDOUT: }
  27. // CHECK:STDOUT: %A.decl: type = interface_decl @A [template = constants.%.1] {} {}
  28. // CHECK:STDOUT: impl_decl @impl {} {
  29. // CHECK:STDOUT: %.loc3_7.1: %.2 = tuple_literal ()
  30. // CHECK:STDOUT: %.loc3_7.2: type = converted %.loc3_7.1, constants.%.2 [template = constants.%.2]
  31. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%.1]
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT: }
  34. // CHECK:STDOUT:
  35. // CHECK:STDOUT: interface @A;
  36. // CHECK:STDOUT:
  37. // CHECK:STDOUT: impl @impl: %.2 as %.1;
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: --- a.impl.carbon
  40. // CHECK:STDOUT:
  41. // CHECK:STDOUT: constants {
  42. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  43. // CHECK:STDOUT: %.2: type = interface_type @A [template]
  44. // CHECK:STDOUT: }
  45. // CHECK:STDOUT:
  46. // CHECK:STDOUT: imports {
  47. // CHECK:STDOUT: %import_ref = import_ref Main//a, inst+1, unloaded
  48. // CHECK:STDOUT: }
  49. // CHECK:STDOUT:
  50. // CHECK:STDOUT: file {
  51. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  52. // CHECK:STDOUT: .A = imports.%import_ref
  53. // CHECK:STDOUT: }
  54. // CHECK:STDOUT: %default.import.loc1_6.1 = import <invalid>
  55. // CHECK:STDOUT: %default.import.loc1_6.2 = import <invalid>
  56. // CHECK:STDOUT: }
  57. // CHECK:STDOUT:
  58. // CHECK:STDOUT: interface @A;
  59. // CHECK:STDOUT:
  60. // CHECK:STDOUT: impl @impl: %.1 as %.2;
  61. // CHECK:STDOUT: