fail_todo_assoc_const_default.carbon 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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/fail_todo_assoc_const_default.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon
  10. interface I {
  11. // CHECK:STDERR: fail_todo_assoc_const_default.carbon:[[@LINE+4]]:3: error: semantics TODO: `interface modifier` [SemanticsTodo]
  12. // CHECK:STDERR: default let T:! type = (i32, i32);
  13. // CHECK:STDERR: ^~~~~~~
  14. // CHECK:STDERR:
  15. default let T:! type = (i32, i32);
  16. // CHECK:STDERR: fail_todo_assoc_const_default.carbon:[[@LINE+4]]:3: error: semantics TODO: `interface modifier` [SemanticsTodo]
  17. // CHECK:STDERR: default let N:! i32 = 42;
  18. // CHECK:STDERR: ^~~~~~~
  19. // CHECK:STDERR:
  20. default let N:! i32 = 42;
  21. }
  22. // CHECK:STDOUT: --- fail_todo_assoc_const_default.carbon
  23. // CHECK:STDOUT:
  24. // CHECK:STDOUT: constants {
  25. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  26. // CHECK:STDOUT: %Self.826: %I.type = bind_symbolic_name Self, 0 [symbolic]
  27. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  28. // CHECK:STDOUT: %assoc0.cd1: %I.assoc_type = assoc_entity element0, @I.%T [concrete]
  29. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  30. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  31. // CHECK:STDOUT: %tuple.type.24b: type = tuple_type (type, type) [concrete]
  32. // CHECK:STDOUT: %tuple.type.d07: type = tuple_type (%i32, %i32) [concrete]
  33. // CHECK:STDOUT: %assoc1: %I.assoc_type = assoc_entity element1, @I.%N [concrete]
  34. // CHECK:STDOUT: %int_42.20e: Core.IntLiteral = int_value 42 [concrete]
  35. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  36. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  37. // CHECK:STDOUT: %impl_witness.d39: <witness> = impl_witness (imports.%Core.import_ref.a5b), @impl.4f9(%int_32) [concrete]
  38. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  39. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  40. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%impl_witness.d39) [concrete]
  41. // CHECK:STDOUT: %.be7: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  42. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_42.20e, %Convert.956 [concrete]
  43. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  44. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_42.20e, %Convert.specific_fn [concrete]
  45. // CHECK:STDOUT: %int_42.c68: %i32 = int_value 42 [concrete]
  46. // CHECK:STDOUT: }
  47. // CHECK:STDOUT:
  48. // CHECK:STDOUT: imports {
  49. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  50. // CHECK:STDOUT: .Int = %Core.Int
  51. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  52. // CHECK:STDOUT: import Core//prelude
  53. // CHECK:STDOUT: import Core//prelude/...
  54. // CHECK:STDOUT: }
  55. // CHECK:STDOUT: }
  56. // CHECK:STDOUT:
  57. // CHECK:STDOUT: file {
  58. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  59. // CHECK:STDOUT: .Core = imports.%Core
  60. // CHECK:STDOUT: .I = %I.decl
  61. // CHECK:STDOUT: }
  62. // CHECK:STDOUT: %Core.import = import Core
  63. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  64. // CHECK:STDOUT: }
  65. // CHECK:STDOUT:
  66. // CHECK:STDOUT: interface @I {
  67. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.826]
  68. // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] {
  69. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%T [concrete = constants.%assoc0.cd1]
  70. // CHECK:STDOUT: %int_32.loc16_27: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  71. // CHECK:STDOUT: %i32.loc16_27: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  72. // CHECK:STDOUT: %int_32.loc16_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  73. // CHECK:STDOUT: %i32.loc16_32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  74. // CHECK:STDOUT: %.loc16_35: %tuple.type.24b = tuple_literal (%i32.loc16_27, %i32.loc16_32)
  75. // CHECK:STDOUT: %.loc16_36: type = converted %.loc16_35, constants.%tuple.type.d07 [concrete = constants.%tuple.type.d07]
  76. // CHECK:STDOUT: }
  77. // CHECK:STDOUT: %N: %i32 = assoc_const_decl @N [concrete] {
  78. // CHECK:STDOUT: %assoc1: %I.assoc_type = assoc_entity element1, @I.%N [concrete = constants.%assoc1]
  79. // CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42.20e]
  80. // CHECK:STDOUT: %impl.elem0: %.be7 = impl_witness_access constants.%impl_witness.d39, element0 [concrete = constants.%Convert.956]
  81. // CHECK:STDOUT: %bound_method.loc21_27.1: <bound method> = bound_method %int_42, %impl.elem0 [concrete = constants.%Convert.bound]
  82. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  83. // CHECK:STDOUT: %bound_method.loc21_27.2: <bound method> = bound_method %int_42, %specific_fn [concrete = constants.%bound_method]
  84. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc21_27.2(%int_42) [concrete = constants.%int_42.c68]
  85. // CHECK:STDOUT: %.loc21_27.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_42.c68]
  86. // CHECK:STDOUT: %.loc21_27.2: %i32 = converted %int_42, %.loc21_27.1 [concrete = constants.%int_42.c68]
  87. // CHECK:STDOUT: }
  88. // CHECK:STDOUT:
  89. // CHECK:STDOUT: !members:
  90. // CHECK:STDOUT: .Self = %Self
  91. // CHECK:STDOUT: .T = @T.%assoc0
  92. // CHECK:STDOUT: .N = @N.%assoc1
  93. // CHECK:STDOUT: witness = (%T, %N)
  94. // CHECK:STDOUT: }
  95. // CHECK:STDOUT:
  96. // CHECK:STDOUT: generic assoc_const @T(@I.%Self: %I.type) {
  97. // CHECK:STDOUT: !definition:
  98. // CHECK:STDOUT:
  99. // CHECK:STDOUT: assoc_const T:! type = %.loc16_36;
  100. // CHECK:STDOUT: }
  101. // CHECK:STDOUT:
  102. // CHECK:STDOUT: generic assoc_const @N(@I.%Self: %I.type) {
  103. // CHECK:STDOUT: !definition:
  104. // CHECK:STDOUT:
  105. // CHECK:STDOUT: assoc_const N:! %i32 = %.loc21_27.2;
  106. // CHECK:STDOUT: }
  107. // CHECK:STDOUT:
  108. // CHECK:STDOUT: specific @T(constants.%Self.826) {}
  109. // CHECK:STDOUT:
  110. // CHECK:STDOUT: specific @N(constants.%Self.826) {}
  111. // CHECK:STDOUT: