assoc_const.carbon 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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/assoc_const.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/assoc_const.carbon
  10. interface I {
  11. let T:! type;
  12. let N:! i32;
  13. }
  14. // CHECK:STDOUT: --- assoc_const.carbon
  15. // CHECK:STDOUT:
  16. // CHECK:STDOUT: constants {
  17. // CHECK:STDOUT: %I.type: type = facet_type <@I> [template]
  18. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  19. // CHECK:STDOUT: %assoc_type.579: type = assoc_entity_type %I.type, type [template]
  20. // CHECK:STDOUT: %assoc0: %assoc_type.579 = assoc_entity element0, @I.%T [template]
  21. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  22. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  23. // CHECK:STDOUT: %assoc_type.b2b: type = assoc_entity_type %I.type, %i32 [template]
  24. // CHECK:STDOUT: %assoc1: %assoc_type.b2b = assoc_entity element1, @I.%N [template]
  25. // CHECK:STDOUT: }
  26. // CHECK:STDOUT:
  27. // CHECK:STDOUT: imports {
  28. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  29. // CHECK:STDOUT: .Int = %import_ref.187
  30. // CHECK:STDOUT: import Core//prelude
  31. // CHECK:STDOUT: import Core//prelude/...
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT: }
  34. // CHECK:STDOUT:
  35. // CHECK:STDOUT: file {
  36. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  37. // CHECK:STDOUT: .Core = imports.%Core
  38. // CHECK:STDOUT: .I = %I.decl
  39. // CHECK:STDOUT: }
  40. // CHECK:STDOUT: %Core.import = import Core
  41. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
  42. // CHECK:STDOUT: }
  43. // CHECK:STDOUT:
  44. // CHECK:STDOUT: interface @I {
  45. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  46. // CHECK:STDOUT: %T: type = assoc_const_decl T [template]
  47. // CHECK:STDOUT: %assoc0: %assoc_type.579 = assoc_entity element0, %T [template = constants.%assoc0]
  48. // CHECK:STDOUT: %N: %i32 = assoc_const_decl N [template]
  49. // CHECK:STDOUT: %assoc1: %assoc_type.b2b = assoc_entity element1, %N [template = constants.%assoc1]
  50. // CHECK:STDOUT:
  51. // CHECK:STDOUT: !members:
  52. // CHECK:STDOUT: .Self = %Self
  53. // CHECK:STDOUT: .T = %assoc0
  54. // CHECK:STDOUT: .N = %assoc1
  55. // CHECK:STDOUT: witness = (%T, %N)
  56. // CHECK:STDOUT: }
  57. // CHECK:STDOUT: