builtins.carbon 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  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. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/primitives.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/builtins.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/builtins.carbon
  12. // --- supported_types.carbon
  13. library "[[@TEST_NAME]]";
  14. import Cpp inline "";
  15. fn F() {
  16. //@dump-sem-ir-begin
  17. let cpp_signed_char : Cpp.signed_char = 1 as i8;
  18. let carbon_signed_char: i8 = cpp_signed_char;
  19. let cpp_short : Cpp.short = 1 as i16;
  20. let carbon_short: i16 = cpp_short;
  21. let cpp_int : Cpp.int = 1 as i32;
  22. let carbon_int: i32 = cpp_int;
  23. let cpp_unsigned_char : Cpp.unsigned_char = 1 as u8;
  24. let carbon_unsigned_char: u8 = cpp_unsigned_char;
  25. let cpp_unsigned_short : Cpp.unsigned_short = 1 as u16;
  26. let carbon_unsigned_short: u16 = cpp_unsigned_short;
  27. let cpp_unsigned_int : Cpp.unsigned_int = 1 as u32;
  28. let carbon_unsigned_int: u32 = cpp_unsigned_int;
  29. let cpp_float : Cpp.float = 1.0 as f32;
  30. let carbon_float: f32 = cpp_float;
  31. let cpp_double : Cpp.double = 1.0 as f64;
  32. let carbon_double: f64 = cpp_double;
  33. //@dump-sem-ir-end
  34. }
  35. // --- fail_todo_unsupported_types.carbon
  36. library "[[@TEST_NAME]]";
  37. import Cpp inline "";
  38. fn F() {
  39. //@dump-sem-ir-begin
  40. // CHECK:STDERR: fail_todo_unsupported_types.carbon:[[@LINE+7]]:25: error: semantics TODO: `Unsupported: builtin type: long double` [SemanticsTodo]
  41. // CHECK:STDERR: let cpp_long_double : Cpp.long_double = 1.0 as f64;
  42. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  43. // CHECK:STDERR: fail_todo_unsupported_types.carbon:[[@LINE+4]]:25: note: in `Cpp` name lookup for `long_double` [InCppNameLookup]
  44. // CHECK:STDERR: let cpp_long_double : Cpp.long_double = 1.0 as f64;
  45. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  46. // CHECK:STDERR:
  47. let cpp_long_double : Cpp.long_double = 1.0 as f64;
  48. let carbon_long_double: f64 = cpp_long_double;
  49. //@dump-sem-ir-end
  50. }
  51. // --- fail_not_builtin.carbon
  52. library "[[@TEST_NAME]]";
  53. import Cpp inline "";
  54. fn F() {
  55. // CHECK:STDERR: fail_not_builtin.carbon:[[@LINE+4]]:21: error: member name `not_builtin` not found in `Cpp` [MemberNameNotFoundInInstScope]
  56. // CHECK:STDERR: let not_builtin : Cpp.not_builtin = 1;
  57. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  58. // CHECK:STDERR:
  59. let not_builtin : Cpp.not_builtin = 1;
  60. }
  61. // --- fail_lookup_in_other_scopes.carbon
  62. library "[[@TEST_NAME]]";
  63. import Cpp inline '''
  64. namespace MyNamespace {}
  65. ''';
  66. fn F() {
  67. // CHECK:STDERR: fail_lookup_in_other_scopes.carbon:[[@LINE+4]]:14: error: member name `long` not found in `Cpp.MyNamespace` [MemberNameNotFoundInInstScope]
  68. // CHECK:STDERR: let long : Cpp.MyNamespace.long = 1;
  69. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  70. // CHECK:STDERR:
  71. let long : Cpp.MyNamespace.long = 1;
  72. }
  73. // --- override_builtin.carbon
  74. library "[[@TEST_NAME]]";
  75. import Cpp inline '''
  76. struct unsigned_int {
  77. auto foo() -> unsigned int;
  78. };
  79. ''';
  80. fn F() {
  81. //@dump-sem-ir-begin
  82. var unsigned_int : Cpp.unsigned_int;
  83. let x: u32 = unsigned_int.foo();
  84. //@dump-sem-ir-end
  85. }
  86. // CHECK:STDOUT: --- supported_types.carbon
  87. // CHECK:STDOUT:
  88. // CHECK:STDOUT: constants {
  89. // CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [concrete]
  90. // CHECK:STDOUT: %i8: type = class_type @Int, @Int(%int_8) [concrete]
  91. // CHECK:STDOUT: %pattern_type.e3f: type = pattern_type %i8 [concrete]
  92. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  93. // CHECK:STDOUT: %As.type.7d7: type = facet_type <@As, @As(%i8)> [concrete]
  94. // CHECK:STDOUT: %As.Convert.type.cc1: type = fn_type @As.Convert, @As(%i8) [concrete]
  95. // CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  96. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.565: type = fn_type @Core.IntLiteral.as.As.impl.Convert.1, @Core.IntLiteral.as.As.impl.dc4(%To) [symbolic]
  97. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.d2c: %Core.IntLiteral.as.As.impl.Convert.type.565 = struct_value () [symbolic]
  98. // CHECK:STDOUT: %As.impl_witness.d74: <witness> = impl_witness imports.%As.impl_witness_table.5ad, @Core.IntLiteral.as.As.impl.dc4(%int_8) [concrete]
  99. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.83e: type = fn_type @Core.IntLiteral.as.As.impl.Convert.1, @Core.IntLiteral.as.As.impl.dc4(%int_8) [concrete]
  100. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.e8b: %Core.IntLiteral.as.As.impl.Convert.type.83e = struct_value () [concrete]
  101. // CHECK:STDOUT: %As.facet.09b: %As.type.7d7 = facet_value Core.IntLiteral, (%As.impl_witness.d74) [concrete]
  102. // CHECK:STDOUT: %.95e: type = fn_type_with_self_type %As.Convert.type.cc1, %As.facet.09b [concrete]
  103. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound.09b: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.e8b [concrete]
  104. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn.2e1: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.e8b, @Core.IntLiteral.as.As.impl.Convert.1(%int_8) [concrete]
  105. // CHECK:STDOUT: %bound_method.967: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn.2e1 [concrete]
  106. // CHECK:STDOUT: %int_1.30e: %i8 = int_value 1 [concrete]
  107. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  108. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  109. // CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete]
  110. // CHECK:STDOUT: %As.type.771: type = facet_type <@As, @As(%i16)> [concrete]
  111. // CHECK:STDOUT: %As.Convert.type.be5: type = fn_type @As.Convert, @As(%i16) [concrete]
  112. // CHECK:STDOUT: %As.impl_witness.2d2: <witness> = impl_witness imports.%As.impl_witness_table.5ad, @Core.IntLiteral.as.As.impl.dc4(%int_16) [concrete]
  113. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.38a: type = fn_type @Core.IntLiteral.as.As.impl.Convert.1, @Core.IntLiteral.as.As.impl.dc4(%int_16) [concrete]
  114. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.97a: %Core.IntLiteral.as.As.impl.Convert.type.38a = struct_value () [concrete]
  115. // CHECK:STDOUT: %As.facet.56b: %As.type.771 = facet_value Core.IntLiteral, (%As.impl_witness.2d2) [concrete]
  116. // CHECK:STDOUT: %.026: type = fn_type_with_self_type %As.Convert.type.be5, %As.facet.56b [concrete]
  117. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound.3fb: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.97a [concrete]
  118. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn.613: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.97a, @Core.IntLiteral.as.As.impl.Convert.1(%int_16) [concrete]
  119. // CHECK:STDOUT: %bound_method.7be: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn.613 [concrete]
  120. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  121. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  122. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  123. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  124. // CHECK:STDOUT: %As.type.dbd: type = facet_type <@As, @As(%i32)> [concrete]
  125. // CHECK:STDOUT: %As.Convert.type.99b: type = fn_type @As.Convert, @As(%i32) [concrete]
  126. // CHECK:STDOUT: %As.impl_witness.080: <witness> = impl_witness imports.%As.impl_witness_table.5ad, @Core.IntLiteral.as.As.impl.dc4(%int_32) [concrete]
  127. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.aaf: type = fn_type @Core.IntLiteral.as.As.impl.Convert.1, @Core.IntLiteral.as.As.impl.dc4(%int_32) [concrete]
  128. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.414: %Core.IntLiteral.as.As.impl.Convert.type.aaf = struct_value () [concrete]
  129. // CHECK:STDOUT: %As.facet.b49: %As.type.dbd = facet_value Core.IntLiteral, (%As.impl_witness.080) [concrete]
  130. // CHECK:STDOUT: %.351: type = fn_type_with_self_type %As.Convert.type.99b, %As.facet.b49 [concrete]
  131. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound.9f3: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.414 [concrete]
  132. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn.478: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.414, @Core.IntLiteral.as.As.impl.Convert.1(%int_32) [concrete]
  133. // CHECK:STDOUT: %bound_method.fb8: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn.478 [concrete]
  134. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  135. // CHECK:STDOUT: %u8: type = class_type @UInt, @UInt(%int_8) [concrete]
  136. // CHECK:STDOUT: %pattern_type.8f3: type = pattern_type %u8 [concrete]
  137. // CHECK:STDOUT: %As.type.340: type = facet_type <@As, @As(%u8)> [concrete]
  138. // CHECK:STDOUT: %As.Convert.type.a56: type = fn_type @As.Convert, @As(%u8) [concrete]
  139. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.972: type = fn_type @Core.IntLiteral.as.As.impl.Convert.2, @Core.IntLiteral.as.As.impl.cc4(%To) [symbolic]
  140. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.276: %Core.IntLiteral.as.As.impl.Convert.type.972 = struct_value () [symbolic]
  141. // CHECK:STDOUT: %As.impl_witness.fb4: <witness> = impl_witness imports.%As.impl_witness_table.e4e, @Core.IntLiteral.as.As.impl.cc4(%int_8) [concrete]
  142. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.d25: type = fn_type @Core.IntLiteral.as.As.impl.Convert.2, @Core.IntLiteral.as.As.impl.cc4(%int_8) [concrete]
  143. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.cd6: %Core.IntLiteral.as.As.impl.Convert.type.d25 = struct_value () [concrete]
  144. // CHECK:STDOUT: %As.facet.81d: %As.type.340 = facet_value Core.IntLiteral, (%As.impl_witness.fb4) [concrete]
  145. // CHECK:STDOUT: %.3dd: type = fn_type_with_self_type %As.Convert.type.a56, %As.facet.81d [concrete]
  146. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound.d14: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.cd6 [concrete]
  147. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn.95d: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.cd6, @Core.IntLiteral.as.As.impl.Convert.2(%int_8) [concrete]
  148. // CHECK:STDOUT: %bound_method.084: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn.95d [concrete]
  149. // CHECK:STDOUT: %int_1.e80: %u8 = int_value 1 [concrete]
  150. // CHECK:STDOUT: %u16: type = class_type @UInt, @UInt(%int_16) [concrete]
  151. // CHECK:STDOUT: %pattern_type.9db: type = pattern_type %u16 [concrete]
  152. // CHECK:STDOUT: %As.type.e67: type = facet_type <@As, @As(%u16)> [concrete]
  153. // CHECK:STDOUT: %As.Convert.type.c7c: type = fn_type @As.Convert, @As(%u16) [concrete]
  154. // CHECK:STDOUT: %As.impl_witness.262: <witness> = impl_witness imports.%As.impl_witness_table.e4e, @Core.IntLiteral.as.As.impl.cc4(%int_16) [concrete]
  155. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.8e7: type = fn_type @Core.IntLiteral.as.As.impl.Convert.2, @Core.IntLiteral.as.As.impl.cc4(%int_16) [concrete]
  156. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.d77: %Core.IntLiteral.as.As.impl.Convert.type.8e7 = struct_value () [concrete]
  157. // CHECK:STDOUT: %As.facet.626: %As.type.e67 = facet_value Core.IntLiteral, (%As.impl_witness.262) [concrete]
  158. // CHECK:STDOUT: %.982: type = fn_type_with_self_type %As.Convert.type.c7c, %As.facet.626 [concrete]
  159. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound.37a: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.d77 [concrete]
  160. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn.427: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.d77, @Core.IntLiteral.as.As.impl.Convert.2(%int_16) [concrete]
  161. // CHECK:STDOUT: %bound_method.552: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn.427 [concrete]
  162. // CHECK:STDOUT: %int_1.3e8: %u16 = int_value 1 [concrete]
  163. // CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [concrete]
  164. // CHECK:STDOUT: %pattern_type.4a9: type = pattern_type %u32 [concrete]
  165. // CHECK:STDOUT: %As.type.45b: type = facet_type <@As, @As(%u32)> [concrete]
  166. // CHECK:STDOUT: %As.Convert.type.b94: type = fn_type @As.Convert, @As(%u32) [concrete]
  167. // CHECK:STDOUT: %As.impl_witness.556: <witness> = impl_witness imports.%As.impl_witness_table.e4e, @Core.IntLiteral.as.As.impl.cc4(%int_32) [concrete]
  168. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.847: type = fn_type @Core.IntLiteral.as.As.impl.Convert.2, @Core.IntLiteral.as.As.impl.cc4(%int_32) [concrete]
  169. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.51e: %Core.IntLiteral.as.As.impl.Convert.type.847 = struct_value () [concrete]
  170. // CHECK:STDOUT: %As.facet.66b: %As.type.45b = facet_value Core.IntLiteral, (%As.impl_witness.556) [concrete]
  171. // CHECK:STDOUT: %.97b: type = fn_type_with_self_type %As.Convert.type.b94, %As.facet.66b [concrete]
  172. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound.8e2: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.51e [concrete]
  173. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn.c3d: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.51e, @Core.IntLiteral.as.As.impl.Convert.2(%int_32) [concrete]
  174. // CHECK:STDOUT: %bound_method.640: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn.c3d [concrete]
  175. // CHECK:STDOUT: %int_1.c1d: %u32 = int_value 1 [concrete]
  176. // CHECK:STDOUT: %f32.97e: type = class_type @Float, @Float(%int_32) [concrete]
  177. // CHECK:STDOUT: %pattern_type.201: type = pattern_type %f32.97e [concrete]
  178. // CHECK:STDOUT: %float.674bbc.1: Core.FloatLiteral = float_literal_value 10e-1 [concrete]
  179. // CHECK:STDOUT: %As.type.d27: type = facet_type <@As, @As(%f32.97e)> [concrete]
  180. // CHECK:STDOUT: %As.Convert.type.f5e: type = fn_type @As.Convert, @As(%f32.97e) [concrete]
  181. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.type.d83: type = fn_type @Core.FloatLiteral.as.As.impl.Convert, @Core.FloatLiteral.as.As.impl(%To) [symbolic]
  182. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.f91: %Core.FloatLiteral.as.As.impl.Convert.type.d83 = struct_value () [symbolic]
  183. // CHECK:STDOUT: %As.impl_witness.f72: <witness> = impl_witness imports.%As.impl_witness_table.e98, @Core.FloatLiteral.as.As.impl(%int_32) [concrete]
  184. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.type.4e7: type = fn_type @Core.FloatLiteral.as.As.impl.Convert, @Core.FloatLiteral.as.As.impl(%int_32) [concrete]
  185. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.890: %Core.FloatLiteral.as.As.impl.Convert.type.4e7 = struct_value () [concrete]
  186. // CHECK:STDOUT: %As.facet.885: %As.type.d27 = facet_value Core.FloatLiteral, (%As.impl_witness.f72) [concrete]
  187. // CHECK:STDOUT: %.47f: type = fn_type_with_self_type %As.Convert.type.f5e, %As.facet.885 [concrete]
  188. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.bound.b9c: <bound method> = bound_method %float.674bbc.1, %Core.FloatLiteral.as.As.impl.Convert.890 [concrete]
  189. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.specific_fn.a94: <specific function> = specific_function %Core.FloatLiteral.as.As.impl.Convert.890, @Core.FloatLiteral.as.As.impl.Convert(%int_32) [concrete]
  190. // CHECK:STDOUT: %bound_method.355: <bound method> = bound_method %float.674bbc.1, %Core.FloatLiteral.as.As.impl.Convert.specific_fn.a94 [concrete]
  191. // CHECK:STDOUT: %float.e3b: %f32.97e = float_value 1 [concrete]
  192. // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete]
  193. // CHECK:STDOUT: %f64.d77: type = class_type @Float, @Float(%int_64) [concrete]
  194. // CHECK:STDOUT: %pattern_type.0ae: type = pattern_type %f64.d77 [concrete]
  195. // CHECK:STDOUT: %float.674bbc.2: Core.FloatLiteral = float_literal_value 10e-1 [concrete]
  196. // CHECK:STDOUT: %As.type.6a8: type = facet_type <@As, @As(%f64.d77)> [concrete]
  197. // CHECK:STDOUT: %As.Convert.type.8fc: type = fn_type @As.Convert, @As(%f64.d77) [concrete]
  198. // CHECK:STDOUT: %As.impl_witness.6b0: <witness> = impl_witness imports.%As.impl_witness_table.e98, @Core.FloatLiteral.as.As.impl(%int_64) [concrete]
  199. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.type.50a: type = fn_type @Core.FloatLiteral.as.As.impl.Convert, @Core.FloatLiteral.as.As.impl(%int_64) [concrete]
  200. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.09c: %Core.FloatLiteral.as.As.impl.Convert.type.50a = struct_value () [concrete]
  201. // CHECK:STDOUT: %As.facet.2ea: %As.type.6a8 = facet_value Core.FloatLiteral, (%As.impl_witness.6b0) [concrete]
  202. // CHECK:STDOUT: %.bee: type = fn_type_with_self_type %As.Convert.type.8fc, %As.facet.2ea [concrete]
  203. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.bound.d51: <bound method> = bound_method %float.674bbc.2, %Core.FloatLiteral.as.As.impl.Convert.09c [concrete]
  204. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.specific_fn.905: <specific function> = specific_function %Core.FloatLiteral.as.As.impl.Convert.09c, @Core.FloatLiteral.as.As.impl.Convert(%int_64) [concrete]
  205. // CHECK:STDOUT: %bound_method.60f: <bound method> = bound_method %float.674bbc.2, %Core.FloatLiteral.as.As.impl.Convert.specific_fn.905 [concrete]
  206. // CHECK:STDOUT: %float.d20: %f64.d77 = float_value 1 [concrete]
  207. // CHECK:STDOUT: }
  208. // CHECK:STDOUT:
  209. // CHECK:STDOUT: imports {
  210. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  211. // CHECK:STDOUT: .signed_char = @F.%i8.1
  212. // CHECK:STDOUT: .short = @F.%i16.1
  213. // CHECK:STDOUT: .int = @F.%i32.1
  214. // CHECK:STDOUT: .unsigned_char = @F.%u8.1
  215. // CHECK:STDOUT: .unsigned_short = @F.%u16.1
  216. // CHECK:STDOUT: .unsigned_int = @F.%u32.1
  217. // CHECK:STDOUT: .float = @F.%f32.1
  218. // CHECK:STDOUT: .double = @F.%f64.1
  219. // CHECK:STDOUT: import Cpp//...
  220. // CHECK:STDOUT: }
  221. // CHECK:STDOUT: %Core.import_ref.99c: @Core.IntLiteral.as.As.impl.dc4.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.565) = import_ref Core//prelude/parts/int, loc32_39, loaded [symbolic = @Core.IntLiteral.as.As.impl.dc4.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.d2c)]
  222. // CHECK:STDOUT: %As.impl_witness_table.5ad = impl_witness_table (%Core.import_ref.99c), @Core.IntLiteral.as.As.impl.dc4 [concrete]
  223. // CHECK:STDOUT: %Core.import_ref.611: @Core.IntLiteral.as.As.impl.cc4.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.972) = import_ref Core//prelude/parts/uint, loc32_40, loaded [symbolic = @Core.IntLiteral.as.As.impl.cc4.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.276)]
  224. // CHECK:STDOUT: %As.impl_witness_table.e4e = impl_witness_table (%Core.import_ref.611), @Core.IntLiteral.as.As.impl.cc4 [concrete]
  225. // CHECK:STDOUT: %Core.import_ref.ea0: @Core.FloatLiteral.as.As.impl.%Core.FloatLiteral.as.As.impl.Convert.type (%Core.FloatLiteral.as.As.impl.Convert.type.d83) = import_ref Core//prelude/parts/float, loc25_41, loaded [symbolic = @Core.FloatLiteral.as.As.impl.%Core.FloatLiteral.as.As.impl.Convert (constants.%Core.FloatLiteral.as.As.impl.Convert.f91)]
  226. // CHECK:STDOUT: %As.impl_witness_table.e98 = impl_witness_table (%Core.import_ref.ea0), @Core.FloatLiteral.as.As.impl [concrete]
  227. // CHECK:STDOUT: }
  228. // CHECK:STDOUT:
  229. // CHECK:STDOUT: fn @F() {
  230. // CHECK:STDOUT: !entry:
  231. // CHECK:STDOUT: name_binding_decl {
  232. // CHECK:STDOUT: %cpp_signed_char.patt: %pattern_type.e3f = binding_pattern cpp_signed_char [concrete]
  233. // CHECK:STDOUT: }
  234. // CHECK:STDOUT: %int_1.loc8: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  235. // CHECK:STDOUT: %int_8.loc8: Core.IntLiteral = int_value 8 [concrete = constants.%int_8]
  236. // CHECK:STDOUT: %i8.loc8: type = class_type @Int, @Int(constants.%int_8) [concrete = constants.%i8]
  237. // CHECK:STDOUT: %impl.elem0.loc8: %.95e = impl_witness_access constants.%As.impl_witness.d74, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.e8b]
  238. // CHECK:STDOUT: %bound_method.loc8_45.1: <bound method> = bound_method %int_1.loc8, %impl.elem0.loc8 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound.09b]
  239. // CHECK:STDOUT: %specific_fn.loc8: <specific function> = specific_function %impl.elem0.loc8, @Core.IntLiteral.as.As.impl.Convert.1(constants.%int_8) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn.2e1]
  240. // CHECK:STDOUT: %bound_method.loc8_45.2: <bound method> = bound_method %int_1.loc8, %specific_fn.loc8 [concrete = constants.%bound_method.967]
  241. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call.loc8: init %i8 = call %bound_method.loc8_45.2(%int_1.loc8) [concrete = constants.%int_1.30e]
  242. // CHECK:STDOUT: %.loc8_45.1: %i8 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call.loc8 [concrete = constants.%int_1.30e]
  243. // CHECK:STDOUT: %.loc8_45.2: %i8 = converted %int_1.loc8, %.loc8_45.1 [concrete = constants.%int_1.30e]
  244. // CHECK:STDOUT: %.loc8_28: type = splice_block %signed_char.ref [concrete = constants.%i8] {
  245. // CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  246. // CHECK:STDOUT: <elided>
  247. // CHECK:STDOUT: %signed_char.ref: type = name_ref signed_char, %i8.1 [concrete = constants.%i8]
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT: %cpp_signed_char: %i8 = bind_name cpp_signed_char, %.loc8_45.2
  250. // CHECK:STDOUT: name_binding_decl {
  251. // CHECK:STDOUT: %carbon_signed_char.patt: %pattern_type.e3f = binding_pattern carbon_signed_char [concrete]
  252. // CHECK:STDOUT: }
  253. // CHECK:STDOUT: %cpp_signed_char.ref: %i8 = name_ref cpp_signed_char, %cpp_signed_char
  254. // CHECK:STDOUT: %.loc9: type = splice_block %i8.loc9 [concrete = constants.%i8] {
  255. // CHECK:STDOUT: %int_8.loc9: Core.IntLiteral = int_value 8 [concrete = constants.%int_8]
  256. // CHECK:STDOUT: %i8.loc9: type = class_type @Int, @Int(constants.%int_8) [concrete = constants.%i8]
  257. // CHECK:STDOUT: }
  258. // CHECK:STDOUT: %carbon_signed_char: %i8 = bind_name carbon_signed_char, %cpp_signed_char.ref
  259. // CHECK:STDOUT: name_binding_decl {
  260. // CHECK:STDOUT: %cpp_short.patt: %pattern_type.2f8 = binding_pattern cpp_short [concrete]
  261. // CHECK:STDOUT: }
  262. // CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  263. // CHECK:STDOUT: %int_16.loc11: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  264. // CHECK:STDOUT: %i16.loc11: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  265. // CHECK:STDOUT: %impl.elem0.loc11: %.026 = impl_witness_access constants.%As.impl_witness.2d2, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.97a]
  266. // CHECK:STDOUT: %bound_method.loc11_33.1: <bound method> = bound_method %int_1.loc11, %impl.elem0.loc11 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound.3fb]
  267. // CHECK:STDOUT: %specific_fn.loc11: <specific function> = specific_function %impl.elem0.loc11, @Core.IntLiteral.as.As.impl.Convert.1(constants.%int_16) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn.613]
  268. // CHECK:STDOUT: %bound_method.loc11_33.2: <bound method> = bound_method %int_1.loc11, %specific_fn.loc11 [concrete = constants.%bound_method.7be]
  269. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call.loc11: init %i16 = call %bound_method.loc11_33.2(%int_1.loc11) [concrete = constants.%int_1.f90]
  270. // CHECK:STDOUT: %.loc11_33.1: %i16 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call.loc11 [concrete = constants.%int_1.f90]
  271. // CHECK:STDOUT: %.loc11_33.2: %i16 = converted %int_1.loc11, %.loc11_33.1 [concrete = constants.%int_1.f90]
  272. // CHECK:STDOUT: %.loc11_22: type = splice_block %short.ref [concrete = constants.%i16] {
  273. // CHECK:STDOUT: %Cpp.ref.loc11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  274. // CHECK:STDOUT: <elided>
  275. // CHECK:STDOUT: %short.ref: type = name_ref short, %i16.1 [concrete = constants.%i16]
  276. // CHECK:STDOUT: }
  277. // CHECK:STDOUT: %cpp_short: %i16 = bind_name cpp_short, %.loc11_33.2
  278. // CHECK:STDOUT: name_binding_decl {
  279. // CHECK:STDOUT: %carbon_short.patt: %pattern_type.2f8 = binding_pattern carbon_short [concrete]
  280. // CHECK:STDOUT: }
  281. // CHECK:STDOUT: %cpp_short.ref: %i16 = name_ref cpp_short, %cpp_short
  282. // CHECK:STDOUT: %.loc12: type = splice_block %i16.loc12 [concrete = constants.%i16] {
  283. // CHECK:STDOUT: %int_16.loc12: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  284. // CHECK:STDOUT: %i16.loc12: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  285. // CHECK:STDOUT: }
  286. // CHECK:STDOUT: %carbon_short: %i16 = bind_name carbon_short, %cpp_short.ref
  287. // CHECK:STDOUT: name_binding_decl {
  288. // CHECK:STDOUT: %cpp_int.patt: %pattern_type.7ce = binding_pattern cpp_int [concrete]
  289. // CHECK:STDOUT: }
  290. // CHECK:STDOUT: %int_1.loc14: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  291. // CHECK:STDOUT: %int_32.loc14: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  292. // CHECK:STDOUT: %i32.loc14: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  293. // CHECK:STDOUT: %impl.elem0.loc14: %.351 = impl_witness_access constants.%As.impl_witness.080, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.414]
  294. // CHECK:STDOUT: %bound_method.loc14_29.1: <bound method> = bound_method %int_1.loc14, %impl.elem0.loc14 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound.9f3]
  295. // CHECK:STDOUT: %specific_fn.loc14: <specific function> = specific_function %impl.elem0.loc14, @Core.IntLiteral.as.As.impl.Convert.1(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn.478]
  296. // CHECK:STDOUT: %bound_method.loc14_29.2: <bound method> = bound_method %int_1.loc14, %specific_fn.loc14 [concrete = constants.%bound_method.fb8]
  297. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call.loc14: init %i32 = call %bound_method.loc14_29.2(%int_1.loc14) [concrete = constants.%int_1.5d2]
  298. // CHECK:STDOUT: %.loc14_29.1: %i32 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call.loc14 [concrete = constants.%int_1.5d2]
  299. // CHECK:STDOUT: %.loc14_29.2: %i32 = converted %int_1.loc14, %.loc14_29.1 [concrete = constants.%int_1.5d2]
  300. // CHECK:STDOUT: %.loc14_20: type = splice_block %int.ref [concrete = constants.%i32] {
  301. // CHECK:STDOUT: %Cpp.ref.loc14: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  302. // CHECK:STDOUT: <elided>
  303. // CHECK:STDOUT: %int.ref: type = name_ref int, %i32.1 [concrete = constants.%i32]
  304. // CHECK:STDOUT: }
  305. // CHECK:STDOUT: %cpp_int: %i32 = bind_name cpp_int, %.loc14_29.2
  306. // CHECK:STDOUT: name_binding_decl {
  307. // CHECK:STDOUT: %carbon_int.patt: %pattern_type.7ce = binding_pattern carbon_int [concrete]
  308. // CHECK:STDOUT: }
  309. // CHECK:STDOUT: %cpp_int.ref: %i32 = name_ref cpp_int, %cpp_int
  310. // CHECK:STDOUT: %.loc15: type = splice_block %i32.loc15 [concrete = constants.%i32] {
  311. // CHECK:STDOUT: %int_32.loc15: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  312. // CHECK:STDOUT: %i32.loc15: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  313. // CHECK:STDOUT: }
  314. // CHECK:STDOUT: %carbon_int: %i32 = bind_name carbon_int, %cpp_int.ref
  315. // CHECK:STDOUT: name_binding_decl {
  316. // CHECK:STDOUT: %cpp_unsigned_char.patt: %pattern_type.8f3 = binding_pattern cpp_unsigned_char [concrete]
  317. // CHECK:STDOUT: }
  318. // CHECK:STDOUT: %int_1.loc17: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  319. // CHECK:STDOUT: %int_8.loc17: Core.IntLiteral = int_value 8 [concrete = constants.%int_8]
  320. // CHECK:STDOUT: %u8.loc17: type = class_type @UInt, @UInt(constants.%int_8) [concrete = constants.%u8]
  321. // CHECK:STDOUT: %impl.elem0.loc17: %.3dd = impl_witness_access constants.%As.impl_witness.fb4, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.cd6]
  322. // CHECK:STDOUT: %bound_method.loc17_49.1: <bound method> = bound_method %int_1.loc17, %impl.elem0.loc17 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound.d14]
  323. // CHECK:STDOUT: %specific_fn.loc17: <specific function> = specific_function %impl.elem0.loc17, @Core.IntLiteral.as.As.impl.Convert.2(constants.%int_8) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn.95d]
  324. // CHECK:STDOUT: %bound_method.loc17_49.2: <bound method> = bound_method %int_1.loc17, %specific_fn.loc17 [concrete = constants.%bound_method.084]
  325. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call.loc17: init %u8 = call %bound_method.loc17_49.2(%int_1.loc17) [concrete = constants.%int_1.e80]
  326. // CHECK:STDOUT: %.loc17_49.1: %u8 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call.loc17 [concrete = constants.%int_1.e80]
  327. // CHECK:STDOUT: %.loc17_49.2: %u8 = converted %int_1.loc17, %.loc17_49.1 [concrete = constants.%int_1.e80]
  328. // CHECK:STDOUT: %.loc17_30: type = splice_block %unsigned_char.ref [concrete = constants.%u8] {
  329. // CHECK:STDOUT: %Cpp.ref.loc17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  330. // CHECK:STDOUT: <elided>
  331. // CHECK:STDOUT: %unsigned_char.ref: type = name_ref unsigned_char, %u8.1 [concrete = constants.%u8]
  332. // CHECK:STDOUT: }
  333. // CHECK:STDOUT: %cpp_unsigned_char: %u8 = bind_name cpp_unsigned_char, %.loc17_49.2
  334. // CHECK:STDOUT: name_binding_decl {
  335. // CHECK:STDOUT: %carbon_unsigned_char.patt: %pattern_type.8f3 = binding_pattern carbon_unsigned_char [concrete]
  336. // CHECK:STDOUT: }
  337. // CHECK:STDOUT: %cpp_unsigned_char.ref: %u8 = name_ref cpp_unsigned_char, %cpp_unsigned_char
  338. // CHECK:STDOUT: %.loc18: type = splice_block %u8.loc18 [concrete = constants.%u8] {
  339. // CHECK:STDOUT: %int_8.loc18: Core.IntLiteral = int_value 8 [concrete = constants.%int_8]
  340. // CHECK:STDOUT: %u8.loc18: type = class_type @UInt, @UInt(constants.%int_8) [concrete = constants.%u8]
  341. // CHECK:STDOUT: }
  342. // CHECK:STDOUT: %carbon_unsigned_char: %u8 = bind_name carbon_unsigned_char, %cpp_unsigned_char.ref
  343. // CHECK:STDOUT: name_binding_decl {
  344. // CHECK:STDOUT: %cpp_unsigned_short.patt: %pattern_type.9db = binding_pattern cpp_unsigned_short [concrete]
  345. // CHECK:STDOUT: }
  346. // CHECK:STDOUT: %int_1.loc20: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  347. // CHECK:STDOUT: %int_16.loc20: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  348. // CHECK:STDOUT: %u16.loc20: type = class_type @UInt, @UInt(constants.%int_16) [concrete = constants.%u16]
  349. // CHECK:STDOUT: %impl.elem0.loc20: %.982 = impl_witness_access constants.%As.impl_witness.262, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.d77]
  350. // CHECK:STDOUT: %bound_method.loc20_51.1: <bound method> = bound_method %int_1.loc20, %impl.elem0.loc20 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound.37a]
  351. // CHECK:STDOUT: %specific_fn.loc20: <specific function> = specific_function %impl.elem0.loc20, @Core.IntLiteral.as.As.impl.Convert.2(constants.%int_16) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn.427]
  352. // CHECK:STDOUT: %bound_method.loc20_51.2: <bound method> = bound_method %int_1.loc20, %specific_fn.loc20 [concrete = constants.%bound_method.552]
  353. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call.loc20: init %u16 = call %bound_method.loc20_51.2(%int_1.loc20) [concrete = constants.%int_1.3e8]
  354. // CHECK:STDOUT: %.loc20_51.1: %u16 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call.loc20 [concrete = constants.%int_1.3e8]
  355. // CHECK:STDOUT: %.loc20_51.2: %u16 = converted %int_1.loc20, %.loc20_51.1 [concrete = constants.%int_1.3e8]
  356. // CHECK:STDOUT: %.loc20_31: type = splice_block %unsigned_short.ref [concrete = constants.%u16] {
  357. // CHECK:STDOUT: %Cpp.ref.loc20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  358. // CHECK:STDOUT: <elided>
  359. // CHECK:STDOUT: %unsigned_short.ref: type = name_ref unsigned_short, %u16.1 [concrete = constants.%u16]
  360. // CHECK:STDOUT: }
  361. // CHECK:STDOUT: %cpp_unsigned_short: %u16 = bind_name cpp_unsigned_short, %.loc20_51.2
  362. // CHECK:STDOUT: name_binding_decl {
  363. // CHECK:STDOUT: %carbon_unsigned_short.patt: %pattern_type.9db = binding_pattern carbon_unsigned_short [concrete]
  364. // CHECK:STDOUT: }
  365. // CHECK:STDOUT: %cpp_unsigned_short.ref: %u16 = name_ref cpp_unsigned_short, %cpp_unsigned_short
  366. // CHECK:STDOUT: %.loc21: type = splice_block %u16.loc21 [concrete = constants.%u16] {
  367. // CHECK:STDOUT: %int_16.loc21: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  368. // CHECK:STDOUT: %u16.loc21: type = class_type @UInt, @UInt(constants.%int_16) [concrete = constants.%u16]
  369. // CHECK:STDOUT: }
  370. // CHECK:STDOUT: %carbon_unsigned_short: %u16 = bind_name carbon_unsigned_short, %cpp_unsigned_short.ref
  371. // CHECK:STDOUT: name_binding_decl {
  372. // CHECK:STDOUT: %cpp_unsigned_int.patt: %pattern_type.4a9 = binding_pattern cpp_unsigned_int [concrete]
  373. // CHECK:STDOUT: }
  374. // CHECK:STDOUT: %int_1.loc23: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  375. // CHECK:STDOUT: %int_32.loc23: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  376. // CHECK:STDOUT: %u32.loc23: type = class_type @UInt, @UInt(constants.%int_32) [concrete = constants.%u32]
  377. // CHECK:STDOUT: %impl.elem0.loc23: %.97b = impl_witness_access constants.%As.impl_witness.556, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.51e]
  378. // CHECK:STDOUT: %bound_method.loc23_47.1: <bound method> = bound_method %int_1.loc23, %impl.elem0.loc23 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound.8e2]
  379. // CHECK:STDOUT: %specific_fn.loc23: <specific function> = specific_function %impl.elem0.loc23, @Core.IntLiteral.as.As.impl.Convert.2(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn.c3d]
  380. // CHECK:STDOUT: %bound_method.loc23_47.2: <bound method> = bound_method %int_1.loc23, %specific_fn.loc23 [concrete = constants.%bound_method.640]
  381. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call.loc23: init %u32 = call %bound_method.loc23_47.2(%int_1.loc23) [concrete = constants.%int_1.c1d]
  382. // CHECK:STDOUT: %.loc23_47.1: %u32 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call.loc23 [concrete = constants.%int_1.c1d]
  383. // CHECK:STDOUT: %.loc23_47.2: %u32 = converted %int_1.loc23, %.loc23_47.1 [concrete = constants.%int_1.c1d]
  384. // CHECK:STDOUT: %.loc23_29: type = splice_block %unsigned_int.ref [concrete = constants.%u32] {
  385. // CHECK:STDOUT: %Cpp.ref.loc23: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  386. // CHECK:STDOUT: <elided>
  387. // CHECK:STDOUT: %unsigned_int.ref: type = name_ref unsigned_int, %u32.1 [concrete = constants.%u32]
  388. // CHECK:STDOUT: }
  389. // CHECK:STDOUT: %cpp_unsigned_int: %u32 = bind_name cpp_unsigned_int, %.loc23_47.2
  390. // CHECK:STDOUT: name_binding_decl {
  391. // CHECK:STDOUT: %carbon_unsigned_int.patt: %pattern_type.4a9 = binding_pattern carbon_unsigned_int [concrete]
  392. // CHECK:STDOUT: }
  393. // CHECK:STDOUT: %cpp_unsigned_int.ref: %u32 = name_ref cpp_unsigned_int, %cpp_unsigned_int
  394. // CHECK:STDOUT: %.loc24: type = splice_block %u32.loc24 [concrete = constants.%u32] {
  395. // CHECK:STDOUT: %int_32.loc24: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  396. // CHECK:STDOUT: %u32.loc24: type = class_type @UInt, @UInt(constants.%int_32) [concrete = constants.%u32]
  397. // CHECK:STDOUT: }
  398. // CHECK:STDOUT: %carbon_unsigned_int: %u32 = bind_name carbon_unsigned_int, %cpp_unsigned_int.ref
  399. // CHECK:STDOUT: name_binding_decl {
  400. // CHECK:STDOUT: %cpp_float.patt: %pattern_type.201 = binding_pattern cpp_float [concrete]
  401. // CHECK:STDOUT: }
  402. // CHECK:STDOUT: %float.loc26: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.674bbc.1]
  403. // CHECK:STDOUT: %int_32.loc26: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  404. // CHECK:STDOUT: %f32.loc26: type = class_type @Float, @Float(constants.%int_32) [concrete = constants.%f32.97e]
  405. // CHECK:STDOUT: %impl.elem0.loc26: %.47f = impl_witness_access constants.%As.impl_witness.f72, element0 [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.890]
  406. // CHECK:STDOUT: %bound_method.loc26_35.1: <bound method> = bound_method %float.loc26, %impl.elem0.loc26 [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.bound.b9c]
  407. // CHECK:STDOUT: %specific_fn.loc26: <specific function> = specific_function %impl.elem0.loc26, @Core.FloatLiteral.as.As.impl.Convert(constants.%int_32) [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.specific_fn.a94]
  408. // CHECK:STDOUT: %bound_method.loc26_35.2: <bound method> = bound_method %float.loc26, %specific_fn.loc26 [concrete = constants.%bound_method.355]
  409. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.call.loc26: init %f32.97e = call %bound_method.loc26_35.2(%float.loc26) [concrete = constants.%float.e3b]
  410. // CHECK:STDOUT: %.loc26_35.1: %f32.97e = value_of_initializer %Core.FloatLiteral.as.As.impl.Convert.call.loc26 [concrete = constants.%float.e3b]
  411. // CHECK:STDOUT: %.loc26_35.2: %f32.97e = converted %float.loc26, %.loc26_35.1 [concrete = constants.%float.e3b]
  412. // CHECK:STDOUT: %.loc26_22: type = splice_block %float.ref [concrete = constants.%f32.97e] {
  413. // CHECK:STDOUT: %Cpp.ref.loc26: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  414. // CHECK:STDOUT: <elided>
  415. // CHECK:STDOUT: %float.ref: type = name_ref float, %f32.1 [concrete = constants.%f32.97e]
  416. // CHECK:STDOUT: }
  417. // CHECK:STDOUT: %cpp_float: %f32.97e = bind_name cpp_float, %.loc26_35.2
  418. // CHECK:STDOUT: name_binding_decl {
  419. // CHECK:STDOUT: %carbon_float.patt: %pattern_type.201 = binding_pattern carbon_float [concrete]
  420. // CHECK:STDOUT: }
  421. // CHECK:STDOUT: %cpp_float.ref: %f32.97e = name_ref cpp_float, %cpp_float
  422. // CHECK:STDOUT: %.loc27: type = splice_block %f32.loc27 [concrete = constants.%f32.97e] {
  423. // CHECK:STDOUT: %int_32.loc27: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  424. // CHECK:STDOUT: %f32.loc27: type = class_type @Float, @Float(constants.%int_32) [concrete = constants.%f32.97e]
  425. // CHECK:STDOUT: }
  426. // CHECK:STDOUT: %carbon_float: %f32.97e = bind_name carbon_float, %cpp_float.ref
  427. // CHECK:STDOUT: name_binding_decl {
  428. // CHECK:STDOUT: %cpp_double.patt: %pattern_type.0ae = binding_pattern cpp_double [concrete]
  429. // CHECK:STDOUT: }
  430. // CHECK:STDOUT: %float.loc29: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.674bbc.2]
  431. // CHECK:STDOUT: %int_64.loc29: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  432. // CHECK:STDOUT: %f64.loc29: type = class_type @Float, @Float(constants.%int_64) [concrete = constants.%f64.d77]
  433. // CHECK:STDOUT: %impl.elem0.loc29: %.bee = impl_witness_access constants.%As.impl_witness.6b0, element0 [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.09c]
  434. // CHECK:STDOUT: %bound_method.loc29_37.1: <bound method> = bound_method %float.loc29, %impl.elem0.loc29 [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.bound.d51]
  435. // CHECK:STDOUT: %specific_fn.loc29: <specific function> = specific_function %impl.elem0.loc29, @Core.FloatLiteral.as.As.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.specific_fn.905]
  436. // CHECK:STDOUT: %bound_method.loc29_37.2: <bound method> = bound_method %float.loc29, %specific_fn.loc29 [concrete = constants.%bound_method.60f]
  437. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.call.loc29: init %f64.d77 = call %bound_method.loc29_37.2(%float.loc29) [concrete = constants.%float.d20]
  438. // CHECK:STDOUT: %.loc29_37.1: %f64.d77 = value_of_initializer %Core.FloatLiteral.as.As.impl.Convert.call.loc29 [concrete = constants.%float.d20]
  439. // CHECK:STDOUT: %.loc29_37.2: %f64.d77 = converted %float.loc29, %.loc29_37.1 [concrete = constants.%float.d20]
  440. // CHECK:STDOUT: %.loc29_23: type = splice_block %double.ref [concrete = constants.%f64.d77] {
  441. // CHECK:STDOUT: %Cpp.ref.loc29: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  442. // CHECK:STDOUT: <elided>
  443. // CHECK:STDOUT: %double.ref: type = name_ref double, %f64.1 [concrete = constants.%f64.d77]
  444. // CHECK:STDOUT: }
  445. // CHECK:STDOUT: %cpp_double: %f64.d77 = bind_name cpp_double, %.loc29_37.2
  446. // CHECK:STDOUT: name_binding_decl {
  447. // CHECK:STDOUT: %carbon_double.patt: %pattern_type.0ae = binding_pattern carbon_double [concrete]
  448. // CHECK:STDOUT: }
  449. // CHECK:STDOUT: %cpp_double.ref: %f64.d77 = name_ref cpp_double, %cpp_double
  450. // CHECK:STDOUT: %.loc30: type = splice_block %f64.loc30 [concrete = constants.%f64.d77] {
  451. // CHECK:STDOUT: %int_64.loc30: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  452. // CHECK:STDOUT: %f64.loc30: type = class_type @Float, @Float(constants.%int_64) [concrete = constants.%f64.d77]
  453. // CHECK:STDOUT: }
  454. // CHECK:STDOUT: %carbon_double: %f64.d77 = bind_name carbon_double, %cpp_double.ref
  455. // CHECK:STDOUT: <elided>
  456. // CHECK:STDOUT: }
  457. // CHECK:STDOUT:
  458. // CHECK:STDOUT: --- fail_todo_unsupported_types.carbon
  459. // CHECK:STDOUT:
  460. // CHECK:STDOUT: constants {
  461. // CHECK:STDOUT: %float.674: Core.FloatLiteral = float_literal_value 10e-1 [concrete]
  462. // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete]
  463. // CHECK:STDOUT: %f64.d77: type = class_type @Float, @Float(%int_64) [concrete]
  464. // CHECK:STDOUT: %As.type.6a8: type = facet_type <@As, @As(%f64.d77)> [concrete]
  465. // CHECK:STDOUT: %As.Convert.type.8fc: type = fn_type @As.Convert, @As(%f64.d77) [concrete]
  466. // CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  467. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.type.d83: type = fn_type @Core.FloatLiteral.as.As.impl.Convert, @Core.FloatLiteral.as.As.impl(%To) [symbolic]
  468. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.f91: %Core.FloatLiteral.as.As.impl.Convert.type.d83 = struct_value () [symbolic]
  469. // CHECK:STDOUT: %As.impl_witness.6b0: <witness> = impl_witness imports.%As.impl_witness_table, @Core.FloatLiteral.as.As.impl(%int_64) [concrete]
  470. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.type.50a: type = fn_type @Core.FloatLiteral.as.As.impl.Convert, @Core.FloatLiteral.as.As.impl(%int_64) [concrete]
  471. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.09c: %Core.FloatLiteral.as.As.impl.Convert.type.50a = struct_value () [concrete]
  472. // CHECK:STDOUT: %As.facet: %As.type.6a8 = facet_value Core.FloatLiteral, (%As.impl_witness.6b0) [concrete]
  473. // CHECK:STDOUT: %.bee: type = fn_type_with_self_type %As.Convert.type.8fc, %As.facet [concrete]
  474. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.bound: <bound method> = bound_method %float.674, %Core.FloatLiteral.as.As.impl.Convert.09c [concrete]
  475. // CHECK:STDOUT: %pattern_type.0ae: type = pattern_type %f64.d77 [concrete]
  476. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.specific_fn: <specific function> = specific_function %Core.FloatLiteral.as.As.impl.Convert.09c, @Core.FloatLiteral.as.As.impl.Convert(%int_64) [concrete]
  477. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %float.674, %Core.FloatLiteral.as.As.impl.Convert.specific_fn [concrete]
  478. // CHECK:STDOUT: %float.d20: %f64.d77 = float_value 1 [concrete]
  479. // CHECK:STDOUT: }
  480. // CHECK:STDOUT:
  481. // CHECK:STDOUT: imports {
  482. // CHECK:STDOUT: %Core.import_ref.ea0: @Core.FloatLiteral.as.As.impl.%Core.FloatLiteral.as.As.impl.Convert.type (%Core.FloatLiteral.as.As.impl.Convert.type.d83) = import_ref Core//prelude/parts/float, loc25_41, loaded [symbolic = @Core.FloatLiteral.as.As.impl.%Core.FloatLiteral.as.As.impl.Convert (constants.%Core.FloatLiteral.as.As.impl.Convert.f91)]
  483. // CHECK:STDOUT: %As.impl_witness_table = impl_witness_table (%Core.import_ref.ea0), @Core.FloatLiteral.as.As.impl [concrete]
  484. // CHECK:STDOUT: }
  485. // CHECK:STDOUT:
  486. // CHECK:STDOUT: fn @F() {
  487. // CHECK:STDOUT: !entry:
  488. // CHECK:STDOUT: name_binding_decl {
  489. // CHECK:STDOUT: %cpp_long_double.patt: <error> = binding_pattern cpp_long_double [concrete]
  490. // CHECK:STDOUT: }
  491. // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.674]
  492. // CHECK:STDOUT: %int_64.loc15: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  493. // CHECK:STDOUT: %f64.loc15: type = class_type @Float, @Float(constants.%int_64) [concrete = constants.%f64.d77]
  494. // CHECK:STDOUT: %impl.elem0: %.bee = impl_witness_access constants.%As.impl_witness.6b0, element0 [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.09c]
  495. // CHECK:STDOUT: %bound_method.loc15_47.1: <bound method> = bound_method %float, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.bound]
  496. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.FloatLiteral.as.As.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.specific_fn]
  497. // CHECK:STDOUT: %bound_method.loc15_47.2: <bound method> = bound_method %float, %specific_fn [concrete = constants.%bound_method]
  498. // CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.call: init %f64.d77 = call %bound_method.loc15_47.2(%float) [concrete = constants.%float.d20]
  499. // CHECK:STDOUT: %.loc15_47.1: %f64.d77 = value_of_initializer %Core.FloatLiteral.as.As.impl.Convert.call [concrete = constants.%float.d20]
  500. // CHECK:STDOUT: %.loc15_47.2: %f64.d77 = converted %float, %.loc15_47.1 [concrete = constants.%float.d20]
  501. // CHECK:STDOUT: <elided>
  502. // CHECK:STDOUT: %cpp_long_double: <error> = bind_name cpp_long_double, <error> [concrete = <error>]
  503. // CHECK:STDOUT: name_binding_decl {
  504. // CHECK:STDOUT: %carbon_long_double.patt: %pattern_type.0ae = binding_pattern carbon_long_double [concrete]
  505. // CHECK:STDOUT: }
  506. // CHECK:STDOUT: %cpp_long_double.ref: <error> = name_ref cpp_long_double, %cpp_long_double [concrete = <error>]
  507. // CHECK:STDOUT: %.loc16: type = splice_block %f64.loc16 [concrete = constants.%f64.d77] {
  508. // CHECK:STDOUT: %int_64.loc16: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  509. // CHECK:STDOUT: %f64.loc16: type = class_type @Float, @Float(constants.%int_64) [concrete = constants.%f64.d77]
  510. // CHECK:STDOUT: }
  511. // CHECK:STDOUT: %carbon_long_double: %f64.d77 = bind_name carbon_long_double, <error> [concrete = <error>]
  512. // CHECK:STDOUT: <elided>
  513. // CHECK:STDOUT: }
  514. // CHECK:STDOUT:
  515. // CHECK:STDOUT: --- override_builtin.carbon
  516. // CHECK:STDOUT:
  517. // CHECK:STDOUT: constants {
  518. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  519. // CHECK:STDOUT: %unsigned_int: type = class_type @unsigned_int [concrete]
  520. // CHECK:STDOUT: %pattern_type.5ec: type = pattern_type %unsigned_int [concrete]
  521. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  522. // CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [concrete]
  523. // CHECK:STDOUT: %pattern_type.4a9: type = pattern_type %u32 [concrete]
  524. // CHECK:STDOUT: %.15a: type = cpp_overload_set_type @unsigned_int.foo [concrete]
  525. // CHECK:STDOUT: %empty_struct: %.15a = struct_value () [concrete]
  526. // CHECK:STDOUT: %ptr.d47: type = ptr_type %unsigned_int [concrete]
  527. // CHECK:STDOUT: %unsigned_int.foo.type: type = fn_type @unsigned_int.foo [concrete]
  528. // CHECK:STDOUT: %unsigned_int.foo: %unsigned_int.foo.type = struct_value () [concrete]
  529. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanAggregateDestroy>> [concrete]
  530. // CHECK:STDOUT: %facet_value: %type_where = facet_value %unsigned_int, () [concrete]
  531. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.type.6ba: type = fn_type @AggregateT.as_type.as.Destroy.impl.Op, @AggregateT.as_type.as.Destroy.impl(%facet_value) [concrete]
  532. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.e27: %AggregateT.as_type.as.Destroy.impl.Op.type.6ba = struct_value () [concrete]
  533. // CHECK:STDOUT: }
  534. // CHECK:STDOUT:
  535. // CHECK:STDOUT: imports {
  536. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  537. // CHECK:STDOUT: .unsigned_int = %unsigned_int.decl
  538. // CHECK:STDOUT: import Cpp//...
  539. // CHECK:STDOUT: }
  540. // CHECK:STDOUT: %unsigned_int.decl: type = class_decl @unsigned_int [concrete = constants.%unsigned_int] {} {}
  541. // CHECK:STDOUT: %.afb: %.15a = cpp_overload_set_value @unsigned_int.foo [concrete = constants.%empty_struct]
  542. // CHECK:STDOUT: %unsigned_int.foo.decl: %unsigned_int.foo.type = fn_decl @unsigned_int.foo [concrete = constants.%unsigned_int.foo] {
  543. // CHECK:STDOUT: <elided>
  544. // CHECK:STDOUT: } {
  545. // CHECK:STDOUT: <elided>
  546. // CHECK:STDOUT: }
  547. // CHECK:STDOUT: }
  548. // CHECK:STDOUT:
  549. // CHECK:STDOUT: fn @F() {
  550. // CHECK:STDOUT: !entry:
  551. // CHECK:STDOUT: name_binding_decl {
  552. // CHECK:STDOUT: %unsigned_int.patt: %pattern_type.5ec = binding_pattern unsigned_int [concrete]
  553. // CHECK:STDOUT: %unsigned_int.var_patt: %pattern_type.5ec = var_pattern %unsigned_int.patt [concrete]
  554. // CHECK:STDOUT: }
  555. // CHECK:STDOUT: %unsigned_int.var: ref %unsigned_int = var %unsigned_int.var_patt
  556. // CHECK:STDOUT: %.loc12_25: type = splice_block %unsigned_int.ref.loc12 [concrete = constants.%unsigned_int] {
  557. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  558. // CHECK:STDOUT: %unsigned_int.ref.loc12: type = name_ref unsigned_int, imports.%unsigned_int.decl [concrete = constants.%unsigned_int]
  559. // CHECK:STDOUT: }
  560. // CHECK:STDOUT: %unsigned_int: ref %unsigned_int = bind_name unsigned_int, %unsigned_int.var
  561. // CHECK:STDOUT: name_binding_decl {
  562. // CHECK:STDOUT: %x.patt: %pattern_type.4a9 = binding_pattern x [concrete]
  563. // CHECK:STDOUT: }
  564. // CHECK:STDOUT: %unsigned_int.ref.loc13: ref %unsigned_int = name_ref unsigned_int, %unsigned_int
  565. // CHECK:STDOUT: %foo.ref: %.15a = name_ref foo, imports.%.afb [concrete = constants.%empty_struct]
  566. // CHECK:STDOUT: %bound_method.loc13: <bound method> = bound_method %unsigned_int.ref.loc13, %foo.ref
  567. // CHECK:STDOUT: %addr.loc13: %ptr.d47 = addr_of %unsigned_int.ref.loc13
  568. // CHECK:STDOUT: %unsigned_int.foo.call: init %u32 = call imports.%unsigned_int.foo.decl(%addr.loc13)
  569. // CHECK:STDOUT: %.loc13_10: type = splice_block %u32 [concrete = constants.%u32] {
  570. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  571. // CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [concrete = constants.%u32]
  572. // CHECK:STDOUT: }
  573. // CHECK:STDOUT: %.loc13_33.1: %u32 = value_of_initializer %unsigned_int.foo.call
  574. // CHECK:STDOUT: %.loc13_33.2: %u32 = converted %unsigned_int.foo.call, %.loc13_33.1
  575. // CHECK:STDOUT: %x: %u32 = bind_name x, %.loc13_33.2
  576. // CHECK:STDOUT: %facet_value: %type_where = facet_value constants.%unsigned_int, () [concrete = constants.%facet_value]
  577. // CHECK:STDOUT: %.loc12_3: %type_where = converted constants.%unsigned_int, %facet_value [concrete = constants.%facet_value]
  578. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %unsigned_int.var, constants.%AggregateT.as_type.as.Destroy.impl.Op.e27
  579. // CHECK:STDOUT: <elided>
  580. // CHECK:STDOUT: %bound_method.loc12: <bound method> = bound_method %unsigned_int.var, %AggregateT.as_type.as.Destroy.impl.Op.specific_fn
  581. // CHECK:STDOUT: %addr.loc12: %ptr.d47 = addr_of %unsigned_int.var
  582. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method.loc12(%addr.loc12)
  583. // CHECK:STDOUT: <elided>
  584. // CHECK:STDOUT: }
  585. // CHECK:STDOUT: