Files
carbon-lang/toolchain/check/testdata/interop/cpp/function/import/function.carbon
T
Chandler Carruth d0badecd2a Switch tests to use the rendered form of diagnostics (#8070)
Historically, we disabled the rendered form in tests outside of
`toolchain/diagnostics`. The idea was to keep tests shorter and avoid
very long chains of autoupdate before stabilizing due to all the line
numbers and other artifacts in the rendered form.

This PR adds `--diagnostic-line-numbers=[all|first]` and defaults to
`first` in tests. This keeps the rendered form so that we can easily
code review that form and the visual cues it does or doesn't provide.
But it removes all but the first location's line numbers to provide
significantly more stability in tests.

By default, tests get the full unicode line-drawing form of diagnostics
so we can ensure all of the artifacts there make sense with the specific
case being diagnosed, but we do retain some focused ASCII-rendering
tests to ensure that fallback remains usable.

There are some issues here that will be fixed in subsequent PRs.
Notably, we try to keep the frame together in the check lines, and so
force some parts to use the first location. This largely works, but
fails in some edge cases, causing the entire frame to be located
incorrectly. There is a TODO about this that we need to fix, and it only
occurs 6 times across the test suite, so it didn't seem worth
front-loading a fix for here.

Assisted-by: Claude Code
2026-11-05 07:19:59 +00:00

448 lines
23 KiB
Plaintext

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/primitives.carbon
//
// AUTOUPDATE
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/function.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/function.carbon
// ============================================================================
// Global
// ============================================================================
// --- global.h
auto global_foo() -> void;
// --- import_global.carbon
library "[[@TEST_NAME]]";
import Cpp library "global.h";
fn MyF() {
//@dump-sem-ir-begin
Cpp.global_foo();
//@dump-sem-ir-end
}
// --- fail_import_global_use_different_name.carbon
library "[[@TEST_NAME]]";
import Cpp library "global.h";
fn MyF() {
// CHECK:STDERR: ╭─┤ fail_import_global_use_different_name.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.bar();
// CHECK:STDERR: · ━━━┳━━━
// CHECK:STDERR: · ┗━━┫ error: member name `bar` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.bar();
}
// ============================================================================
// Carbon keyword name
// ============================================================================
// --- special_name.h
auto base() -> void;
// --- fail_import_special_name_call_unescaped.carbon
library "[[@TEST_NAME]]";
import Cpp library "special_name.h";
fn MyF() {
// CHECK:STDERR: ╭─┤ fail_import_special_name_call_unescaped.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.base();
// CHECK:STDERR: · ━━━━┳━━━
// CHECK:STDERR: · ┗━━┫ error: member name `base` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.base();
}
// --- import_special_name_call_escaped.carbon
library "[[@TEST_NAME]]";
import Cpp library "special_name.h";
fn MyF() {
//@dump-sem-ir-begin
Cpp.r#base();
//@dump-sem-ir-end
}
// --- fail_import_special_name_call_escaped_no_match.carbon
library "[[@TEST_NAME]]";
import Cpp library "special_name.h";
fn MyF() {
// CHECK:STDERR: ╭─┤ fail_import_special_name_call_escaped_no_match.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Cpp.r#base(1);
// CHECK:STDERR: · ━━━━━┳━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'base'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./special_name.h
// CHECK:STDERR: │ auto base() -> void;
// CHECK:STDERR: · ┬ ─┬
// CHECK:STDERR: · ╰───────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ requires 0 arguments, but 1 was provided
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.r#base(1);
}
// ============================================================================
// Overloaded
// ============================================================================
// --- overloaded.h
auto overloaded_foo() -> void;
auto overloaded_foo(int value) -> void;
// --- import_overloaded.carbon
library "[[@TEST_NAME]]";
import Cpp library "overloaded.h";
fn F() {
//@dump-sem-ir-begin
Cpp.overloaded_foo();
//@dump-sem-ir-end
}
// ============================================================================
// Variadic arguments
// ============================================================================
// --- variadic.h
auto variadic_foo(int x, ...) -> void;
// --- fail_todo_import_variadic.carbon
library "[[@TEST_NAME]]";
import Cpp library "variadic.h";
fn F() {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_todo_import_variadic.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.variadic_foo(8);
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: Variadic function`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.variadic_foo(8);
//@dump-sem-ir-end
}
// ============================================================================
// Static
// ============================================================================
// --- static.h
// TODO: Promote this warning to an error by default.
// CHECK:STDERR: ╭─┤ ./static.h:[[@LINE+13]]:13
// CHECK:STDERR: -> │ static auto static_foo() -> void;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: function 'static_foo' has internal linkage but is not
// CHECK:STDERR: · ┃ defined
// CHECK:STDERR: · ┃ [CppInteropParseWarning]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ todo_fail_import_static.carbon
// CHECK:STDERR: │ Cpp.static_foo();
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ used here [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
static auto static_foo() -> void;
// --- todo_fail_import_static.carbon
library "[[@TEST_NAME]]";
import Cpp library "static.h";
fn F() {
//@dump-sem-ir-begin
Cpp.static_foo();
//@dump-sem-ir-end
}
// --- template_function.h
template<typename T>
auto template_foo(T a) -> void;
template<typename T>
auto template_bar(T a) -> T;
// --- import_template_function.carbon
library "[[@TEST_NAME]]";
import Cpp library "template_function.h";
fn F() {
//@dump-sem-ir-begin
Cpp.template_foo(1 as i32);
//@dump-sem-ir-end
}
fn G() -> i32 {
//@dump-sem-ir-begin
return Cpp.template_bar(1 as i32);
//@dump-sem-ir-end
}
// TODO: Add a test per unsupported param type. See https://github.com/carbon-language/carbon-lang/pull/5477/files/4321e21ed27d987fd71be182d292973fd9849df8#r2094655176
// TODO: Add a test per unsupported return type. See https://github.com/carbon-language/carbon-lang/pull/5477/files/4321e21ed27d987fd71be182d292973fd9849df8#r2094655176
// CHECK:STDOUT: --- import_global.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
// CHECK:STDOUT: %global_foo.cpp_overload_set.type: type = cpp_overload_set_type @global_foo.cpp_overload_set [concrete]
// CHECK:STDOUT: %global_foo.cpp_overload_set.value: %global_foo.cpp_overload_set.type = cpp_overload_set_value @global_foo.cpp_overload_set [concrete]
// CHECK:STDOUT: %global_foo.type: type = fn_type @global_foo [concrete]
// CHECK:STDOUT: %global_foo: %global_foo.type = struct_value () [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
// CHECK:STDOUT: .global_foo = %global_foo.cpp_overload_set.value
// CHECK:STDOUT: import Cpp//...
// CHECK:STDOUT: }
// CHECK:STDOUT: %global_foo.cpp_overload_set.value: %global_foo.cpp_overload_set.type = cpp_overload_set_value @global_foo.cpp_overload_set [concrete = constants.%global_foo.cpp_overload_set.value]
// CHECK:STDOUT: %global_foo.decl: %global_foo.type = fn_decl @global_foo [concrete = constants.%global_foo] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @MyF() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %global_foo.ref: %global_foo.cpp_overload_set.type = name_ref global_foo, imports.%global_foo.cpp_overload_set.value [concrete = constants.%global_foo.cpp_overload_set.value]
// CHECK:STDOUT: %global_foo.call: init %empty_tuple.type = call imports.%global_foo.decl()
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- import_special_name_call_escaped.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
// CHECK:STDOUT: %base.cpp_overload_set.type: type = cpp_overload_set_type @base.cpp_overload_set [concrete]
// CHECK:STDOUT: %base.cpp_overload_set.value: %base.cpp_overload_set.type = cpp_overload_set_value @base.cpp_overload_set [concrete]
// CHECK:STDOUT: %base.type: type = fn_type @base [concrete]
// CHECK:STDOUT: %base: %base.type = struct_value () [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
// CHECK:STDOUT: .r#base = %base.cpp_overload_set.value
// CHECK:STDOUT: import Cpp//...
// CHECK:STDOUT: }
// CHECK:STDOUT: %base.cpp_overload_set.value: %base.cpp_overload_set.type = cpp_overload_set_value @base.cpp_overload_set [concrete = constants.%base.cpp_overload_set.value]
// CHECK:STDOUT: %base.decl: %base.type = fn_decl @base [concrete = constants.%base] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @MyF() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %base.ref: %base.cpp_overload_set.type = name_ref r#base, imports.%base.cpp_overload_set.value [concrete = constants.%base.cpp_overload_set.value]
// CHECK:STDOUT: %base.call: init %empty_tuple.type = call imports.%base.decl()
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- import_overloaded.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
// CHECK:STDOUT: %overloaded_foo.cpp_overload_set.type: type = cpp_overload_set_type @overloaded_foo.cpp_overload_set [concrete]
// CHECK:STDOUT: %overloaded_foo.cpp_overload_set.value: %overloaded_foo.cpp_overload_set.type = cpp_overload_set_value @overloaded_foo.cpp_overload_set [concrete]
// CHECK:STDOUT: %overloaded_foo.type: type = fn_type @overloaded_foo [concrete]
// CHECK:STDOUT: %overloaded_foo: %overloaded_foo.type = struct_value () [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
// CHECK:STDOUT: .overloaded_foo = %overloaded_foo.cpp_overload_set.value
// CHECK:STDOUT: import Cpp//...
// CHECK:STDOUT: }
// CHECK:STDOUT: %overloaded_foo.cpp_overload_set.value: %overloaded_foo.cpp_overload_set.type = cpp_overload_set_value @overloaded_foo.cpp_overload_set [concrete = constants.%overloaded_foo.cpp_overload_set.value]
// CHECK:STDOUT: %overloaded_foo.decl: %overloaded_foo.type = fn_decl @overloaded_foo [concrete = constants.%overloaded_foo] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %overloaded_foo.ref: %overloaded_foo.cpp_overload_set.type = name_ref overloaded_foo, imports.%overloaded_foo.cpp_overload_set.value [concrete = constants.%overloaded_foo.cpp_overload_set.value]
// CHECK:STDOUT: %overloaded_foo.call: init %empty_tuple.type = call imports.%overloaded_foo.decl()
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- fail_todo_import_variadic.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
// CHECK:STDOUT: %variadic_foo.cpp_overload_set.type: type = cpp_overload_set_type @variadic_foo.cpp_overload_set [concrete]
// CHECK:STDOUT: %variadic_foo.cpp_overload_set.value: %variadic_foo.cpp_overload_set.type = cpp_overload_set_value @variadic_foo.cpp_overload_set [concrete]
// CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
// CHECK:STDOUT: .variadic_foo = %variadic_foo.cpp_overload_set.value
// CHECK:STDOUT: import Cpp//...
// CHECK:STDOUT: }
// CHECK:STDOUT: %variadic_foo.cpp_overload_set.value: %variadic_foo.cpp_overload_set.type = cpp_overload_set_value @variadic_foo.cpp_overload_set [concrete = constants.%variadic_foo.cpp_overload_set.value]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %variadic_foo.ref: %variadic_foo.cpp_overload_set.type = name_ref variadic_foo, imports.%variadic_foo.cpp_overload_set.value [concrete = constants.%variadic_foo.cpp_overload_set.value]
// CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [concrete = constants.%int_8]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- todo_fail_import_static.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
// CHECK:STDOUT: %static_foo.cpp_overload_set.type: type = cpp_overload_set_type @static_foo.cpp_overload_set [concrete]
// CHECK:STDOUT: %static_foo.cpp_overload_set.value: %static_foo.cpp_overload_set.type = cpp_overload_set_value @static_foo.cpp_overload_set [concrete]
// CHECK:STDOUT: %static_foo.type: type = fn_type @static_foo [concrete]
// CHECK:STDOUT: %static_foo: %static_foo.type = struct_value () [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
// CHECK:STDOUT: .static_foo = %static_foo.cpp_overload_set.value
// CHECK:STDOUT: import Cpp//...
// CHECK:STDOUT: }
// CHECK:STDOUT: %static_foo.cpp_overload_set.value: %static_foo.cpp_overload_set.type = cpp_overload_set_value @static_foo.cpp_overload_set [concrete = constants.%static_foo.cpp_overload_set.value]
// CHECK:STDOUT: %static_foo.decl: %static_foo.type = fn_decl @static_foo [concrete = constants.%static_foo] {} {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %static_foo.ref: %static_foo.cpp_overload_set.type = name_ref static_foo, imports.%static_foo.cpp_overload_set.value [concrete = constants.%static_foo.cpp_overload_set.value]
// CHECK:STDOUT: %static_foo.call: init %empty_tuple.type = call imports.%static_foo.decl()
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- import_template_function.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
// CHECK:STDOUT: %template_foo.cpp_overload_set.type: type = cpp_overload_set_type @template_foo.cpp_overload_set [concrete]
// CHECK:STDOUT: %template_foo.cpp_overload_set.value: %template_foo.cpp_overload_set.type = cpp_overload_set_value @template_foo.cpp_overload_set [concrete]
// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
// CHECK:STDOUT: %As.type.b93: type = facet_type <@As, @As(%i32)> [concrete]
// CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.396: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%To) [symbolic]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.84a: %Core.IntLiteral.as.As.impl.Convert.type.396 = struct_value () [symbolic]
// CHECK:STDOUT: %As.impl_witness.e09: <witness> = impl_witness imports.%As.impl_witness_table.1c2, @Core.IntLiteral.as.As.impl(%int_32) [concrete]
// CHECK:STDOUT: %As.facet: %As.type.b93 = facet_value Core.IntLiteral, (%As.impl_witness.e09) [concrete]
// CHECK:STDOUT: %As.WithSelf.Convert.type.2be: type = fn_type @As.WithSelf.Convert, @As.WithSelf(%i32, %As.facet) [concrete]
// CHECK:STDOUT: %.979: type = fn_type_with_self_type %As.WithSelf.Convert.type.2be, %As.facet [concrete]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.2b0: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%int_32) [concrete]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.94f: %Core.IntLiteral.as.As.impl.Convert.type.2b0 = struct_value () [concrete]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.94f [concrete]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.94f, @Core.IntLiteral.as.As.impl.Convert(%int_32) [concrete]
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn [concrete]
// CHECK:STDOUT: %int_1.68a: %i32 = int_value 1 [concrete]
// CHECK:STDOUT: %template_foo.type: type = fn_type @template_foo [concrete]
// CHECK:STDOUT: %template_foo: %template_foo.type = struct_value () [concrete]
// CHECK:STDOUT: %template_bar.cpp_overload_set.type: type = cpp_overload_set_type @template_bar.cpp_overload_set [concrete]
// CHECK:STDOUT: %template_bar.cpp_overload_set.value: %template_bar.cpp_overload_set.type = cpp_overload_set_value @template_bar.cpp_overload_set [concrete]
// CHECK:STDOUT: %template_bar.type: type = fn_type @template_bar [concrete]
// CHECK:STDOUT: %template_bar: %template_bar.type = struct_value () [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
// CHECK:STDOUT: .template_foo = %template_foo.cpp_overload_set.value
// CHECK:STDOUT: .template_bar = %template_bar.cpp_overload_set.value
// CHECK:STDOUT: import Cpp//...
// CHECK:STDOUT: }
// CHECK:STDOUT: %template_foo.cpp_overload_set.value: %template_foo.cpp_overload_set.type = cpp_overload_set_value @template_foo.cpp_overload_set [concrete = constants.%template_foo.cpp_overload_set.value]
// CHECK:STDOUT: %Core.import_ref.9e0: @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.396) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.84a)]
// CHECK:STDOUT: %As.impl_witness_table.1c2 = impl_witness_table (%Core.import_ref.9e0), @Core.IntLiteral.as.As.impl [concrete]
// CHECK:STDOUT: %template_foo.decl: %template_foo.type = fn_decl @template_foo [concrete = constants.%template_foo] {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: } {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: %template_bar.cpp_overload_set.value: %template_bar.cpp_overload_set.type = cpp_overload_set_value @template_bar.cpp_overload_set [concrete = constants.%template_bar.cpp_overload_set.value]
// CHECK:STDOUT: %template_bar.decl: %template_bar.type = fn_decl @template_bar [concrete = constants.%template_bar] {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: } {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %template_foo.ref: %template_foo.cpp_overload_set.type = name_ref template_foo, imports.%template_foo.cpp_overload_set.value [concrete = constants.%template_foo.cpp_overload_set.value]
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
// CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
// CHECK:STDOUT: %impl.elem0: %.979 = impl_witness_access constants.%As.impl_witness.e09, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.94f]
// CHECK:STDOUT: %bound_method.loc8_22.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound]
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.As.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc8_22.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call: init %i32 = call %bound_method.loc8_22.2(%int_1) [concrete = constants.%int_1.68a]
// CHECK:STDOUT: %.loc8_22.1: %i32 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call [concrete = constants.%int_1.68a]
// CHECK:STDOUT: %.loc8_22.2: %i32 = converted %int_1, %.loc8_22.1 [concrete = constants.%int_1.68a]
// CHECK:STDOUT: %template_foo.call: init %empty_tuple.type = call imports.%template_foo.decl(%.loc8_22.2)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @G() -> out %return.param: %i32 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %template_bar.ref: %template_bar.cpp_overload_set.type = name_ref template_bar, imports.%template_bar.cpp_overload_set.value [concrete = constants.%template_bar.cpp_overload_set.value]
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
// CHECK:STDOUT: %i32.loc14: type = type_literal constants.%i32 [concrete = constants.%i32]
// CHECK:STDOUT: %impl.elem0: %.979 = impl_witness_access constants.%As.impl_witness.e09, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.94f]
// CHECK:STDOUT: %bound_method.loc14_29.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound]
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.As.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc14_29.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call: init %i32 = call %bound_method.loc14_29.2(%int_1) [concrete = constants.%int_1.68a]
// CHECK:STDOUT: %.loc14_29.1: %i32 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call [concrete = constants.%int_1.68a]
// CHECK:STDOUT: %.loc14_29.2: %i32 = converted %int_1, %.loc14_29.1 [concrete = constants.%int_1.68a]
// CHECK:STDOUT: %template_bar.call: init %i32 = call imports.%template_bar.decl(%.loc14_29.2)
// CHECK:STDOUT: return %template_bar.call
// CHECK:STDOUT: }
// CHECK:STDOUT: