mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-17 22:30:30 +00:00
Diagnostic rendering was part of the data model: `Loc::FormatLocation` and `Loc::FormatSnippet` wrote plain text to a stream, so no capability, color, or terminal width could reach them. A diagnostic is now one message with labels, contexts, and location information attached, and `Diagnostics::Renderer` draws it into a `Terminal::Buffer`. The design is in `toolchain/docs/diagnostics_rendering.md` (#7668), authoring in `toolchain/docs/diagnostics.md`. Before: ``` example.carbon:6:3: error: 1 argument passed to function expecting 0 arguments Run0(1); ^~~~~~~ example.carbon:3:1: note: calling function declared here fn Run0() {} ^~~~~~~~~~~ ``` After: ``` error: 1 argument passed to function expecting 0 arguments ╭─┤ example.carbon:6:3 ┆ 3 │ fn Run0() {} · ─────┬───── · ╰──┤ calling function declared here ┆ -> 6 │ Run0(1); · ─────── ╰──────────── ``` `--no-diagnostic-snippets` gives a compact form, `example.carbon:6:3-9`. File tests use it; the rendering tests under `toolchain/diagnostics/testdata` ask for snippets. C++ interop diagnostics are data now rather than text Clang drew: `SemIR::ClangSourceLocId` names a `clang::SourceRange`, and a Clang location is marked as the point it names. `StreamConsumer` moves to a `:renderer` target that `:emitter` does not depend on, keeping `common/terminal` out of `consumer.h`. Capabilities come from the file behind the error stream, so tests get plain ASCII. `renderer_fuzzer` draws diagnostics built from fuzzer bytes with every capability combination, since a shape the renderer doesn't expect must never be why the compiler dies while reporting a problem. TODOs mark the follow-ups: line weights and crossing lines, wrapping that keeps a quoted type whole, and ordering diagnostics that share a byte offset. Also: `IncorrectExtension`'s hint moves into its message, since its note had no location of its own, and `strip_noise` in `check_diagnostics.py` blanks multi-line `#define`s instead of deleting them. Assisted-by: Claude Code
513 lines
37 KiB
Plaintext
513 lines
37 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/int.carbon
|
|
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
|
|
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/adapter/init_adapt.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/adapter/init_adapt.carbon
|
|
|
|
// --- init_adapt.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
class C {
|
|
var a: i32;
|
|
var b: i32;
|
|
}
|
|
|
|
class AdaptC {
|
|
adapt C;
|
|
}
|
|
|
|
let a: C = {.a = 1, .b = 2};
|
|
|
|
let b: AdaptC = a as AdaptC;
|
|
|
|
let c: C = b as C;
|
|
|
|
fn MakeC() -> C;
|
|
|
|
fn MakeAdaptC() -> AdaptC;
|
|
|
|
var d: AdaptC = MakeC() as AdaptC;
|
|
|
|
var e: C = MakeAdaptC() as C;
|
|
|
|
// --- fail_not_implicit.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
class C {
|
|
var a: i32;
|
|
var b: i32;
|
|
}
|
|
|
|
class AdaptC {
|
|
adapt C;
|
|
}
|
|
|
|
let a: C = {.a = 1, .b = 2};
|
|
|
|
// Cannot implicitly convert between a type and an adapter for the type.
|
|
|
|
// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+3]]:17: error: cannot implicitly convert expression of type `C` to `AdaptC` [ConversionFailure]
|
|
// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+2]]:17: note: type `C` does not implement interface `Core.ImplicitAs(AdaptC)` [MissingImplInMemberAccessInContext]
|
|
// CHECK:STDERR:
|
|
let b: AdaptC = a;
|
|
|
|
// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+3]]:12: error: cannot implicitly convert expression of type `AdaptC` to `C` [ConversionFailure]
|
|
// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+2]]:12: note: type `AdaptC` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext]
|
|
// CHECK:STDERR:
|
|
let c: C = b;
|
|
|
|
fn MakeC() -> C;
|
|
|
|
fn MakeAdaptC() -> AdaptC;
|
|
|
|
// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+3]]:1-13: error: cannot implicitly convert expression of type `C` to `AdaptC` [ConversionFailure]
|
|
// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+2]]:1-13: note: type `C` does not implement interface `Core.ImplicitAs(AdaptC)` [MissingImplInMemberAccessInContext]
|
|
// CHECK:STDERR:
|
|
var d: AdaptC = MakeC();
|
|
|
|
// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+3]]:1-8: error: cannot implicitly convert expression of type `AdaptC` to `C` [ConversionFailure]
|
|
// CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+2]]:1-8: note: type `AdaptC` does not implement interface `Core.ImplicitAs(C)` [MissingImplInMemberAccessInContext]
|
|
// CHECK:STDERR:
|
|
var e: C = MakeAdaptC();
|
|
|
|
// CHECK:STDOUT: --- init_adapt.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
|
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
|
// CHECK:STDOUT: %Int.type: type = parameterized_class_name_type @Int [concrete]
|
|
// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
|
// CHECK:STDOUT: %C.elem: type = unbound_element_type %C, %i32 [concrete]
|
|
// CHECK:STDOUT: %struct_type.a.b.250: type = struct_type {.a: %i32, .b: %i32} [concrete]
|
|
// CHECK:STDOUT: %complete_type.eb8: <witness> = complete_type_witness %struct_type.a.b.250 [concrete]
|
|
// CHECK:STDOUT: %AdaptC: type = class_type @AdaptC [concrete]
|
|
// CHECK:STDOUT: %pattern_type.98b: type = pattern_type %C [concrete]
|
|
// CHECK:STDOUT: %a.patt: %pattern_type.98b = value_binding_pattern a [concrete]
|
|
// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
|
|
// CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete]
|
|
// CHECK:STDOUT: %struct_type.a.b.cfd: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [concrete]
|
|
// CHECK:STDOUT: %struct: %struct_type.a.b.cfd = struct_value (%int_1.5b8, %int_2.ecc) [concrete]
|
|
// CHECK:STDOUT: %ImplicitAs.type.0ff: type = generic_interface_type @ImplicitAs [concrete]
|
|
// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.0ff = struct_value () [concrete]
|
|
// CHECK:STDOUT: %ImplicitAs.type.6b0: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
|
|
// CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
|
|
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.3c6: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
|
|
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.6f2: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.3c6 = struct_value () [symbolic]
|
|
// CHECK:STDOUT: %ImplicitAs.impl_witness.d73: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.f53, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
|
|
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.766: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
|
|
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.f60: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.766 = struct_value () [concrete]
|
|
// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.6b0 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.d73) [concrete]
|
|
// CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type.58f: type = fn_type @ImplicitAs.WithSelf.Convert, @ImplicitAs.WithSelf(%i32, %ImplicitAs.facet) [concrete]
|
|
// CHECK:STDOUT: %.33a: type = fn_type_with_self_type %ImplicitAs.WithSelf.Convert.type.58f, %ImplicitAs.facet [concrete]
|
|
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.f60 [concrete]
|
|
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.f60, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
|
|
// CHECK:STDOUT: %bound_method.3bd: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
|
|
// CHECK:STDOUT: %int_1.68a: %i32 = int_value 1 [concrete]
|
|
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6: <bound method> = bound_method %int_2.ecc, %Core.IntLiteral.as.ImplicitAs.impl.Convert.f60 [concrete]
|
|
// CHECK:STDOUT: %bound_method.a55: <bound method> = bound_method %int_2.ecc, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
|
|
// CHECK:STDOUT: %int_2.2e0: %i32 = int_value 2 [concrete]
|
|
// CHECK:STDOUT: %C.val: %C = struct_value (%int_1.68a, %int_2.2e0) [concrete]
|
|
// CHECK:STDOUT: %.1cf: ref %C = temporary invalid, %C.val [concrete]
|
|
// CHECK:STDOUT: %pattern_type.720: type = pattern_type %AdaptC [concrete]
|
|
// CHECK:STDOUT: %b.patt: %pattern_type.720 = value_binding_pattern b [concrete]
|
|
// CHECK:STDOUT: %c.patt: %pattern_type.98b = value_binding_pattern c [concrete]
|
|
// CHECK:STDOUT: %.a44: Core.Form = init_form %C [concrete]
|
|
// CHECK:STDOUT: %return.param_patt.89a: %pattern_type.98b = out_param_pattern [concrete]
|
|
// CHECK:STDOUT: %return.patt.e4a: %pattern_type.98b = return_slot_pattern %return.param_patt.89a, %C [concrete]
|
|
// CHECK:STDOUT: %MakeC.type: type = fn_type @MakeC [concrete]
|
|
// CHECK:STDOUT: %MakeC: %MakeC.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %.624: Core.Form = init_form %AdaptC [concrete]
|
|
// CHECK:STDOUT: %return.param_patt.788: %pattern_type.720 = out_param_pattern [concrete]
|
|
// CHECK:STDOUT: %return.patt.794: %pattern_type.720 = return_slot_pattern %return.param_patt.788, %AdaptC [concrete]
|
|
// CHECK:STDOUT: %MakeAdaptC.type: type = fn_type @MakeAdaptC [concrete]
|
|
// CHECK:STDOUT: %MakeAdaptC: %MakeAdaptC.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %d.patt: %pattern_type.720 = ref_binding_pattern d [concrete]
|
|
// CHECK:STDOUT: %d.var_patt: %pattern_type.720 = var_pattern %d.patt [concrete]
|
|
// CHECK:STDOUT: %e.patt: %pattern_type.98b = ref_binding_pattern e [concrete]
|
|
// CHECK:STDOUT: %e.var_patt: %pattern_type.98b = var_pattern %e.patt [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
|
// CHECK:STDOUT: .Int = %Core.Int
|
|
// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
|
|
// CHECK:STDOUT: import Core//prelude
|
|
// CHECK:STDOUT: import Core//prelude/...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
|
|
// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.0ff = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
|
|
// CHECK:STDOUT: %Core.import_ref.e47: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.3c6) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.6f2)]
|
|
// CHECK:STDOUT: %ImplicitAs.impl_witness_table.f53 = impl_witness_table (%Core.import_ref.e47), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .Core = imports.%Core
|
|
// CHECK:STDOUT: .C = %C.decl
|
|
// CHECK:STDOUT: .AdaptC = %AdaptC.decl
|
|
// CHECK:STDOUT: .a = %a
|
|
// CHECK:STDOUT: .b = %b
|
|
// CHECK:STDOUT: .c = %c
|
|
// CHECK:STDOUT: .MakeC = %MakeC.decl
|
|
// CHECK:STDOUT: .MakeAdaptC = %MakeAdaptC.decl
|
|
// CHECK:STDOUT: .d = %d
|
|
// CHECK:STDOUT: .e = %e
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core.import = import Core
|
|
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: %AdaptC.decl: type = class_decl @AdaptC [concrete = constants.%AdaptC] {} {}
|
|
// CHECK:STDOUT: %impl.elem0.loc13_27.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60]
|
|
// CHECK:STDOUT: %bound_method.loc13_27.1: <bound method> = bound_method @__global_init.%int_1, %impl.elem0.loc13_27.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282]
|
|
// CHECK:STDOUT: %specific_fn.loc13_27.1: <specific function> = specific_function %impl.elem0.loc13_27.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
|
// CHECK:STDOUT: %bound_method.loc13_27.2: <bound method> = bound_method @__global_init.%int_1, %specific_fn.loc13_27.1 [concrete = constants.%bound_method.3bd]
|
|
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_27.1: init %i32 = call %bound_method.loc13_27.2(@__global_init.%int_1) [concrete = constants.%int_1.68a]
|
|
// CHECK:STDOUT: %.loc13_27.1: init %i32 = converted @__global_init.%int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_27.1 [concrete = constants.%int_1.68a]
|
|
// CHECK:STDOUT: %.loc13_27.2: ref %C = temporary_storage
|
|
// CHECK:STDOUT: %.loc13_27.3: ref %i32 = class_element_access %.loc13_27.2, element0
|
|
// CHECK:STDOUT: %.loc13_27.4: init %i32 to %.loc13_27.3 = in_place_init %.loc13_27.1 [concrete = constants.%int_1.68a]
|
|
// CHECK:STDOUT: %impl.elem0.loc13_27.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60]
|
|
// CHECK:STDOUT: %bound_method.loc13_27.3: <bound method> = bound_method @__global_init.%int_2, %impl.elem0.loc13_27.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6]
|
|
// CHECK:STDOUT: %specific_fn.loc13_27.2: <specific function> = specific_function %impl.elem0.loc13_27.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
|
// CHECK:STDOUT: %bound_method.loc13_27.4: <bound method> = bound_method @__global_init.%int_2, %specific_fn.loc13_27.2 [concrete = constants.%bound_method.a55]
|
|
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_27.2: init %i32 = call %bound_method.loc13_27.4(@__global_init.%int_2) [concrete = constants.%int_2.2e0]
|
|
// CHECK:STDOUT: %.loc13_27.5: init %i32 = converted @__global_init.%int_2, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_27.2 [concrete = constants.%int_2.2e0]
|
|
// CHECK:STDOUT: %.loc13_27.6: ref %i32 = class_element_access %.loc13_27.2, element1
|
|
// CHECK:STDOUT: %.loc13_27.7: init %i32 to %.loc13_27.6 = in_place_init %.loc13_27.5 [concrete = constants.%int_2.2e0]
|
|
// CHECK:STDOUT: %.loc13_27.8: init %C to %.loc13_27.2 = class_init (%.loc13_27.4, %.loc13_27.7) [concrete = constants.%C.val]
|
|
// CHECK:STDOUT: %.loc13_27.9: init %C = converted @__global_init.%.loc13, %.loc13_27.8 [concrete = constants.%C.val]
|
|
// CHECK:STDOUT: %.loc13_27.10: ref %C = temporary %.loc13_27.2, %.loc13_27.9 [concrete = constants.%.1cf]
|
|
// CHECK:STDOUT: %.loc13_27.11: %C = acquire_value %.loc13_27.10 [concrete = constants.%C.val]
|
|
// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [concrete = constants.%C]
|
|
// CHECK:STDOUT: %a: %C = wrapper_binding a, %.loc13_27.11
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %a.patt: %pattern_type.98b = value_binding_pattern a [concrete = constants.%a.patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %AdaptC.ref.loc15: type = name_ref AdaptC, %AdaptC.decl [concrete = constants.%AdaptC]
|
|
// CHECK:STDOUT: %b: %AdaptC = wrapper_binding b, @__global_init.%.loc15_19.2
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %b.patt: %pattern_type.720 = value_binding_pattern b [concrete = constants.%b.patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, %C.decl [concrete = constants.%C]
|
|
// CHECK:STDOUT: %c: %C = wrapper_binding c, @__global_init.%.loc17_14.2
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %c.patt: %pattern_type.98b = value_binding_pattern c [concrete = constants.%c.patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %MakeC.decl: %MakeC.type = fn_decl @MakeC [concrete = constants.%MakeC] {
|
|
// CHECK:STDOUT: %return.param_patt: %pattern_type.98b = out_param_pattern [concrete = constants.%return.param_patt.89a]
|
|
// CHECK:STDOUT: %return.patt: %pattern_type.98b = return_slot_pattern %return.param_patt, %C.ref [concrete = constants.%return.patt.e4a]
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
|
|
// CHECK:STDOUT: %.loc19: Core.Form = init_form %C.ref [concrete = constants.%.a44]
|
|
// CHECK:STDOUT: %return.param: ref %C = out_param call_param0
|
|
// CHECK:STDOUT: %return: ref %C = return_slot %return.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %MakeAdaptC.decl: %MakeAdaptC.type = fn_decl @MakeAdaptC [concrete = constants.%MakeAdaptC] {
|
|
// CHECK:STDOUT: %return.param_patt: %pattern_type.720 = out_param_pattern [concrete = constants.%return.param_patt.788]
|
|
// CHECK:STDOUT: %return.patt: %pattern_type.720 = return_slot_pattern %return.param_patt, %AdaptC.ref [concrete = constants.%return.patt.794]
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %AdaptC.ref: type = name_ref AdaptC, file.%AdaptC.decl [concrete = constants.%AdaptC]
|
|
// CHECK:STDOUT: %.loc21: Core.Form = init_form %AdaptC.ref [concrete = constants.%.624]
|
|
// CHECK:STDOUT: %return.param: ref %AdaptC = out_param call_param0
|
|
// CHECK:STDOUT: %return: ref %AdaptC = return_slot %return.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %d.var: ref %AdaptC = var_storage %d.var_patt [concrete]
|
|
// CHECK:STDOUT: %AdaptC.ref.loc23: type = name_ref AdaptC, %AdaptC.decl [concrete = constants.%AdaptC]
|
|
// CHECK:STDOUT: %d: ref %AdaptC = wrapper_binding d, %d.var [concrete = %d.var]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %d.patt: %pattern_type.720 = ref_binding_pattern d [concrete = constants.%d.patt]
|
|
// CHECK:STDOUT: %d.var_patt: %pattern_type.720 = var_pattern %d.patt [concrete = constants.%d.var_patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %e.var: ref %C = var_storage %e.var_patt [concrete]
|
|
// CHECK:STDOUT: %C.ref.loc25: type = name_ref C, %C.decl [concrete = constants.%C]
|
|
// CHECK:STDOUT: %e: ref %C = wrapper_binding e, %e.var [concrete = %e.var]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %e.patt: %pattern_type.98b = ref_binding_pattern e [concrete = constants.%e.patt]
|
|
// CHECK:STDOUT: %e.var_patt: %pattern_type.98b = var_pattern %e.patt [concrete = constants.%e.var_patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C {
|
|
// CHECK:STDOUT: %field_decl.loc5: %C.elem = field_decl a, element0, %i32.loc5 in [concrete] {
|
|
// CHECK:STDOUT: %i32.loc5: type = type_literal constants.%i32 [concrete = constants.%i32]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %field_decl.loc6: %C.elem = field_decl b, element1, %i32.loc6 in [concrete] {
|
|
// CHECK:STDOUT: %i32.loc6: type = type_literal constants.%i32 [concrete = constants.%i32]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.a.b.250 [concrete = constants.%complete_type.eb8]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%C
|
|
// CHECK:STDOUT: .a = %field_decl.loc5
|
|
// CHECK:STDOUT: .b = %field_decl.loc6
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @AdaptC {
|
|
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
|
|
// CHECK:STDOUT: adapt_decl %C.ref [concrete]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.a.b.250 [concrete = constants.%complete_type.eb8]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%AdaptC
|
|
// CHECK:STDOUT: .C = <poisoned>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @MakeC() -> out %return.param: %C;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @MakeAdaptC() -> out %return.param: %AdaptC;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @__global_init() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
|
|
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc]
|
|
// CHECK:STDOUT: %.loc13: %struct_type.a.b.cfd = struct_literal (%int_1, %int_2) [concrete = constants.%struct]
|
|
// CHECK:STDOUT: %a.ref: %C = name_ref a, file.%a
|
|
// CHECK:STDOUT: %AdaptC.ref.loc15: type = name_ref AdaptC, file.%AdaptC.decl [concrete = constants.%AdaptC]
|
|
// CHECK:STDOUT: %.loc15_19.1: %AdaptC = as_compatible %a.ref
|
|
// CHECK:STDOUT: %.loc15_19.2: %AdaptC = converted %a.ref, %.loc15_19.1
|
|
// CHECK:STDOUT: %b.ref: %AdaptC = name_ref b, file.%b
|
|
// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, file.%C.decl [concrete = constants.%C]
|
|
// CHECK:STDOUT: %.loc17_14.1: %C = as_compatible %b.ref
|
|
// CHECK:STDOUT: %.loc17_14.2: %C = converted %b.ref, %.loc17_14.1
|
|
// CHECK:STDOUT: %MakeC.ref: %MakeC.type = name_ref MakeC, file.%MakeC.decl [concrete = constants.%MakeC]
|
|
// CHECK:STDOUT: %.loc23_1: ref %AdaptC = splice_block file.%d.var [concrete = file.%d.var] {}
|
|
// CHECK:STDOUT: %MakeC.call: init %C to %.loc23_1 = call %MakeC.ref()
|
|
// CHECK:STDOUT: %AdaptC.ref.loc23: type = name_ref AdaptC, file.%AdaptC.decl [concrete = constants.%AdaptC]
|
|
// CHECK:STDOUT: %.loc23_25.1: init %AdaptC = as_compatible %MakeC.call
|
|
// CHECK:STDOUT: %.loc23_25.2: init %AdaptC = converted %MakeC.call, %.loc23_25.1
|
|
// CHECK:STDOUT: assign file.%d.var, %.loc23_25.2
|
|
// CHECK:STDOUT: %MakeAdaptC.ref: %MakeAdaptC.type = name_ref MakeAdaptC, file.%MakeAdaptC.decl [concrete = constants.%MakeAdaptC]
|
|
// CHECK:STDOUT: %.loc25_1: ref %C = splice_block file.%e.var [concrete = file.%e.var] {}
|
|
// CHECK:STDOUT: %MakeAdaptC.call: init %AdaptC to %.loc25_1 = call %MakeAdaptC.ref()
|
|
// CHECK:STDOUT: %C.ref.loc25: type = name_ref C, file.%C.decl [concrete = constants.%C]
|
|
// CHECK:STDOUT: %.loc25_25.1: init %C = as_compatible %MakeAdaptC.call
|
|
// CHECK:STDOUT: %.loc25_25.2: init %C = converted %MakeAdaptC.call, %.loc25_25.1
|
|
// CHECK:STDOUT: assign file.%e.var, %.loc25_25.2
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_not_implicit.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
|
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
|
// CHECK:STDOUT: %Int.type: type = parameterized_class_name_type @Int [concrete]
|
|
// CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
|
// CHECK:STDOUT: %C.elem: type = unbound_element_type %C, %i32 [concrete]
|
|
// CHECK:STDOUT: %struct_type.a.b.250: type = struct_type {.a: %i32, .b: %i32} [concrete]
|
|
// CHECK:STDOUT: %complete_type.eb8: <witness> = complete_type_witness %struct_type.a.b.250 [concrete]
|
|
// CHECK:STDOUT: %AdaptC: type = class_type @AdaptC [concrete]
|
|
// CHECK:STDOUT: %pattern_type.98b: type = pattern_type %C [concrete]
|
|
// CHECK:STDOUT: %a.patt: %pattern_type.98b = value_binding_pattern a [concrete]
|
|
// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
|
|
// CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete]
|
|
// CHECK:STDOUT: %struct_type.a.b.cfd: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral} [concrete]
|
|
// CHECK:STDOUT: %struct: %struct_type.a.b.cfd = struct_value (%int_1.5b8, %int_2.ecc) [concrete]
|
|
// CHECK:STDOUT: %ImplicitAs.type.0ff: type = generic_interface_type @ImplicitAs [concrete]
|
|
// CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.0ff = struct_value () [concrete]
|
|
// CHECK:STDOUT: %ImplicitAs.type.6b0: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
|
|
// CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
|
|
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.3c6: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
|
|
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.6f2: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.3c6 = struct_value () [symbolic]
|
|
// CHECK:STDOUT: %ImplicitAs.impl_witness.d73: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.f53, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
|
|
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.766: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
|
|
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.f60: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.766 = struct_value () [concrete]
|
|
// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.6b0 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.d73) [concrete]
|
|
// CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type.58f: type = fn_type @ImplicitAs.WithSelf.Convert, @ImplicitAs.WithSelf(%i32, %ImplicitAs.facet) [concrete]
|
|
// CHECK:STDOUT: %.33a: type = fn_type_with_self_type %ImplicitAs.WithSelf.Convert.type.58f, %ImplicitAs.facet [concrete]
|
|
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.f60 [concrete]
|
|
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.f60, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
|
|
// CHECK:STDOUT: %bound_method.3bd: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
|
|
// CHECK:STDOUT: %int_1.68a: %i32 = int_value 1 [concrete]
|
|
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6: <bound method> = bound_method %int_2.ecc, %Core.IntLiteral.as.ImplicitAs.impl.Convert.f60 [concrete]
|
|
// CHECK:STDOUT: %bound_method.a55: <bound method> = bound_method %int_2.ecc, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
|
|
// CHECK:STDOUT: %int_2.2e0: %i32 = int_value 2 [concrete]
|
|
// CHECK:STDOUT: %C.val: %C = struct_value (%int_1.68a, %int_2.2e0) [concrete]
|
|
// CHECK:STDOUT: %.1cf: ref %C = temporary invalid, %C.val [concrete]
|
|
// CHECK:STDOUT: %pattern_type.720: type = pattern_type %AdaptC [concrete]
|
|
// CHECK:STDOUT: %b.patt: %pattern_type.720 = value_binding_pattern b [concrete]
|
|
// CHECK:STDOUT: %c.patt: %pattern_type.98b = value_binding_pattern c [concrete]
|
|
// CHECK:STDOUT: %.a44: Core.Form = init_form %C [concrete]
|
|
// CHECK:STDOUT: %return.param_patt.89a: %pattern_type.98b = out_param_pattern [concrete]
|
|
// CHECK:STDOUT: %return.patt.e4a: %pattern_type.98b = return_slot_pattern %return.param_patt.89a, %C [concrete]
|
|
// CHECK:STDOUT: %MakeC.type: type = fn_type @MakeC [concrete]
|
|
// CHECK:STDOUT: %MakeC: %MakeC.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %.624: Core.Form = init_form %AdaptC [concrete]
|
|
// CHECK:STDOUT: %return.param_patt.788: %pattern_type.720 = out_param_pattern [concrete]
|
|
// CHECK:STDOUT: %return.patt.794: %pattern_type.720 = return_slot_pattern %return.param_patt.788, %AdaptC [concrete]
|
|
// CHECK:STDOUT: %MakeAdaptC.type: type = fn_type @MakeAdaptC [concrete]
|
|
// CHECK:STDOUT: %MakeAdaptC: %MakeAdaptC.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %d.patt: %pattern_type.720 = ref_binding_pattern d [concrete]
|
|
// CHECK:STDOUT: %d.var_patt: %pattern_type.720 = var_pattern %d.patt [concrete]
|
|
// CHECK:STDOUT: %e.patt: %pattern_type.98b = ref_binding_pattern e [concrete]
|
|
// CHECK:STDOUT: %e.var_patt: %pattern_type.98b = var_pattern %e.patt [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
|
|
// CHECK:STDOUT: .Int = %Core.Int
|
|
// CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
|
|
// CHECK:STDOUT: import Core//prelude
|
|
// CHECK:STDOUT: import Core//prelude/...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
|
|
// CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.0ff = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
|
|
// CHECK:STDOUT: %Core.import_ref.e47: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.3c6) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.6f2)]
|
|
// CHECK:STDOUT: %ImplicitAs.impl_witness_table.f53 = impl_witness_table (%Core.import_ref.e47), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .Core = imports.%Core
|
|
// CHECK:STDOUT: .C = %C.decl
|
|
// CHECK:STDOUT: .AdaptC = %AdaptC.decl
|
|
// CHECK:STDOUT: .a = %a
|
|
// CHECK:STDOUT: .b = %b
|
|
// CHECK:STDOUT: .c = %c
|
|
// CHECK:STDOUT: .MakeC = %MakeC.decl
|
|
// CHECK:STDOUT: .MakeAdaptC = %MakeAdaptC.decl
|
|
// CHECK:STDOUT: .d = %d
|
|
// CHECK:STDOUT: .e = %e
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core.import = import Core
|
|
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: %AdaptC.decl: type = class_decl @AdaptC [concrete = constants.%AdaptC] {} {}
|
|
// CHECK:STDOUT: %impl.elem0.loc13_27.1: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60]
|
|
// CHECK:STDOUT: %bound_method.loc13_27.1: <bound method> = bound_method @__global_init.%int_1, %impl.elem0.loc13_27.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.282]
|
|
// CHECK:STDOUT: %specific_fn.loc13_27.1: <specific function> = specific_function %impl.elem0.loc13_27.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
|
// CHECK:STDOUT: %bound_method.loc13_27.2: <bound method> = bound_method @__global_init.%int_1, %specific_fn.loc13_27.1 [concrete = constants.%bound_method.3bd]
|
|
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_27.1: init %i32 = call %bound_method.loc13_27.2(@__global_init.%int_1) [concrete = constants.%int_1.68a]
|
|
// CHECK:STDOUT: %.loc13_27.1: init %i32 = converted @__global_init.%int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_27.1 [concrete = constants.%int_1.68a]
|
|
// CHECK:STDOUT: %.loc13_27.2: ref %C = temporary_storage
|
|
// CHECK:STDOUT: %.loc13_27.3: ref %i32 = class_element_access %.loc13_27.2, element0
|
|
// CHECK:STDOUT: %.loc13_27.4: init %i32 to %.loc13_27.3 = in_place_init %.loc13_27.1 [concrete = constants.%int_1.68a]
|
|
// CHECK:STDOUT: %impl.elem0.loc13_27.2: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60]
|
|
// CHECK:STDOUT: %bound_method.loc13_27.3: <bound method> = bound_method @__global_init.%int_2, %impl.elem0.loc13_27.2 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a6]
|
|
// CHECK:STDOUT: %specific_fn.loc13_27.2: <specific function> = specific_function %impl.elem0.loc13_27.2, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
|
// CHECK:STDOUT: %bound_method.loc13_27.4: <bound method> = bound_method @__global_init.%int_2, %specific_fn.loc13_27.2 [concrete = constants.%bound_method.a55]
|
|
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_27.2: init %i32 = call %bound_method.loc13_27.4(@__global_init.%int_2) [concrete = constants.%int_2.2e0]
|
|
// CHECK:STDOUT: %.loc13_27.5: init %i32 = converted @__global_init.%int_2, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13_27.2 [concrete = constants.%int_2.2e0]
|
|
// CHECK:STDOUT: %.loc13_27.6: ref %i32 = class_element_access %.loc13_27.2, element1
|
|
// CHECK:STDOUT: %.loc13_27.7: init %i32 to %.loc13_27.6 = in_place_init %.loc13_27.5 [concrete = constants.%int_2.2e0]
|
|
// CHECK:STDOUT: %.loc13_27.8: init %C to %.loc13_27.2 = class_init (%.loc13_27.4, %.loc13_27.7) [concrete = constants.%C.val]
|
|
// CHECK:STDOUT: %.loc13_27.9: init %C = converted @__global_init.%.loc13, %.loc13_27.8 [concrete = constants.%C.val]
|
|
// CHECK:STDOUT: %.loc13_27.10: ref %C = temporary %.loc13_27.2, %.loc13_27.9 [concrete = constants.%.1cf]
|
|
// CHECK:STDOUT: %.loc13_27.11: %C = acquire_value %.loc13_27.10 [concrete = constants.%C.val]
|
|
// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [concrete = constants.%C]
|
|
// CHECK:STDOUT: %a: %C = wrapper_binding a, %.loc13_27.11
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %a.patt: %pattern_type.98b = value_binding_pattern a [concrete = constants.%a.patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %.loc20: %AdaptC = converted @__global_init.%a.ref, <error> [concrete = <error>]
|
|
// CHECK:STDOUT: %AdaptC.ref.loc20: type = name_ref AdaptC, %AdaptC.decl [concrete = constants.%AdaptC]
|
|
// CHECK:STDOUT: %b: %AdaptC = wrapper_binding b, <error> [concrete = <error>]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %b.patt: %pattern_type.720 = value_binding_pattern b [concrete = constants.%b.patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %.loc25: %C = converted @__global_init.%b.ref, <error> [concrete = <error>]
|
|
// CHECK:STDOUT: %C.ref.loc25: type = name_ref C, %C.decl [concrete = constants.%C]
|
|
// CHECK:STDOUT: %c: %C = wrapper_binding c, <error> [concrete = <error>]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %c.patt: %pattern_type.98b = value_binding_pattern c [concrete = constants.%c.patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %MakeC.decl: %MakeC.type = fn_decl @MakeC [concrete = constants.%MakeC] {
|
|
// CHECK:STDOUT: %return.param_patt: %pattern_type.98b = out_param_pattern [concrete = constants.%return.param_patt.89a]
|
|
// CHECK:STDOUT: %return.patt: %pattern_type.98b = return_slot_pattern %return.param_patt, %C.ref [concrete = constants.%return.patt.e4a]
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
|
|
// CHECK:STDOUT: %.loc27: Core.Form = init_form %C.ref [concrete = constants.%.a44]
|
|
// CHECK:STDOUT: %return.param: ref %C = out_param call_param0
|
|
// CHECK:STDOUT: %return: ref %C = return_slot %return.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %MakeAdaptC.decl: %MakeAdaptC.type = fn_decl @MakeAdaptC [concrete = constants.%MakeAdaptC] {
|
|
// CHECK:STDOUT: %return.param_patt: %pattern_type.720 = out_param_pattern [concrete = constants.%return.param_patt.788]
|
|
// CHECK:STDOUT: %return.patt: %pattern_type.720 = return_slot_pattern %return.param_patt, %AdaptC.ref [concrete = constants.%return.patt.794]
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %AdaptC.ref: type = name_ref AdaptC, file.%AdaptC.decl [concrete = constants.%AdaptC]
|
|
// CHECK:STDOUT: %.loc29: Core.Form = init_form %AdaptC.ref [concrete = constants.%.624]
|
|
// CHECK:STDOUT: %return.param: ref %AdaptC = out_param call_param0
|
|
// CHECK:STDOUT: %return: ref %AdaptC = return_slot %return.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %d.var: ref %AdaptC = var_storage %d.var_patt [concrete]
|
|
// CHECK:STDOUT: %AdaptC.ref.loc34: type = name_ref AdaptC, %AdaptC.decl [concrete = constants.%AdaptC]
|
|
// CHECK:STDOUT: %d: ref %AdaptC = wrapper_binding d, %d.var [concrete = %d.var]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %d.patt: %pattern_type.720 = ref_binding_pattern d [concrete = constants.%d.patt]
|
|
// CHECK:STDOUT: %d.var_patt: %pattern_type.720 = var_pattern %d.patt [concrete = constants.%d.var_patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %e.var: ref %C = var_storage %e.var_patt [concrete]
|
|
// CHECK:STDOUT: %C.ref.loc39: type = name_ref C, %C.decl [concrete = constants.%C]
|
|
// CHECK:STDOUT: %e: ref %C = wrapper_binding e, %e.var [concrete = %e.var]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %e.patt: %pattern_type.98b = ref_binding_pattern e [concrete = constants.%e.patt]
|
|
// CHECK:STDOUT: %e.var_patt: %pattern_type.98b = var_pattern %e.patt [concrete = constants.%e.var_patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C {
|
|
// CHECK:STDOUT: %field_decl.loc5: %C.elem = field_decl a, element0, %i32.loc5 in [concrete] {
|
|
// CHECK:STDOUT: %i32.loc5: type = type_literal constants.%i32 [concrete = constants.%i32]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %field_decl.loc6: %C.elem = field_decl b, element1, %i32.loc6 in [concrete] {
|
|
// CHECK:STDOUT: %i32.loc6: type = type_literal constants.%i32 [concrete = constants.%i32]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.a.b.250 [concrete = constants.%complete_type.eb8]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%C
|
|
// CHECK:STDOUT: .a = %field_decl.loc5
|
|
// CHECK:STDOUT: .b = %field_decl.loc6
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @AdaptC {
|
|
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
|
|
// CHECK:STDOUT: adapt_decl %C.ref [concrete]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.a.b.250 [concrete = constants.%complete_type.eb8]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%AdaptC
|
|
// CHECK:STDOUT: .C = <poisoned>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @MakeC() -> out %return.param: %C;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @MakeAdaptC() -> out %return.param: %AdaptC;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @__global_init() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
|
|
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc]
|
|
// CHECK:STDOUT: %.loc13: %struct_type.a.b.cfd = struct_literal (%int_1, %int_2) [concrete = constants.%struct]
|
|
// CHECK:STDOUT: %a.ref: %C = name_ref a, file.%a
|
|
// CHECK:STDOUT: %b.ref: %AdaptC = name_ref b, file.%b [concrete = <error>]
|
|
// CHECK:STDOUT: %MakeC.ref: %MakeC.type = name_ref MakeC, file.%MakeC.decl [concrete = constants.%MakeC]
|
|
// CHECK:STDOUT: %.loc34_23: ref %C = temporary_storage
|
|
// CHECK:STDOUT: %MakeC.call: init %C to %.loc34_23 = call %MakeC.ref()
|
|
// CHECK:STDOUT: %.loc34_1: %AdaptC = converted %MakeC.call, <error> [concrete = <error>]
|
|
// CHECK:STDOUT: assign file.%d.var, <error>
|
|
// CHECK:STDOUT: %MakeAdaptC.ref: %MakeAdaptC.type = name_ref MakeAdaptC, file.%MakeAdaptC.decl [concrete = constants.%MakeAdaptC]
|
|
// CHECK:STDOUT: %.loc39_23: ref %AdaptC = temporary_storage
|
|
// CHECK:STDOUT: %MakeAdaptC.call: init %AdaptC to %.loc39_23 = call %MakeAdaptC.ref()
|
|
// CHECK:STDOUT: %.loc39_1: %C = converted %MakeAdaptC.call, <error> [concrete = <error>]
|
|
// CHECK:STDOUT: assign file.%e.var, <error>
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|