mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 18:50:09 +01:00
* Rewrite constraints are stored in a facet type, substituted, imported, and formatted. * We now distinguish `.Self` from other symbolic bindings in two ways: * `.Self` itself now has an invalid compile time binding index (since it doesn't bind to any of the generic parameters). As a result, we no longer need to create a generic region in `handle_where.cpp`. * There is a new phase tracking values that are only symbolic because they transitively depend on `.Self`. This allows us to give the result of a `where` expression template phase as long as it doesn't use any symbolic constants other than `.Self` or other designators. * `AddConstant` has been removed from `check/context` since it was only used from `eval`. This meant less plumbing of the phase change. * Evaluation of `BindSymbolicName` now also performs substitution into its type. * Include a bit more information in some diagnostics. * `StringifyTypeExpr` outputs rewrites, which required adding support for associated entities as well. * Associated entities now have an entity name set when importing. * Adds tests for some interesting cases with rewrites and uses of `.Self` mixed with other symbolic constants. Still to do: * There is no validation that any particular type satisfies rewrite constraints. * Access to members of a facet type do not see the rewritten values. * Impls don't recognize whether associated constants have rewrites setting their values. * No support for resolving facet types. --------- Co-authored-by: Josh L <josh11b@users.noreply.github.com> Co-authored-by: Richard Smith <richard@metafoo.co.uk>
1075 lines
59 KiB
Plaintext
1075 lines
59 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
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/no_prelude/interface_args.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/interface_args.carbon
|
|
|
|
// --- action.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
interface Action(T:! type) {
|
|
fn Op();
|
|
}
|
|
|
|
class A {}
|
|
class B {}
|
|
class C {}
|
|
|
|
impl A as Action(B) {
|
|
fn Op() {}
|
|
}
|
|
|
|
fn F(a: A) { a.(Action(B).Op)(); }
|
|
|
|
// --- action.impl.carbon
|
|
|
|
impl library "[[@TEST_NAME]]";
|
|
|
|
fn G(a: A) { a.(Action(B).Op)(); }
|
|
|
|
// --- fail_action.impl.carbon
|
|
|
|
impl library "[[@TEST_NAME]]";
|
|
|
|
// CHECK:STDERR: fail_action.impl.carbon:[[@LINE+4]]:14: error: cannot access member of interface `Action(C)` in type `A` that does not implement that interface [MissingImplInMemberAccess]
|
|
// CHECK:STDERR: fn G(a: A) { a.(Action(C).Op)(); }
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
fn G(a: A) { a.(Action(C).Op)(); }
|
|
|
|
// --- factory.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
interface Factory(T:! type) {
|
|
fn Make() -> T;
|
|
}
|
|
|
|
class A {}
|
|
class B {}
|
|
|
|
impl A as Factory(B) {
|
|
fn Make() -> B;
|
|
}
|
|
|
|
// --- factory.impl.carbon
|
|
|
|
impl library "[[@TEST_NAME]]";
|
|
|
|
fn MakeB(a: A) -> B {
|
|
return a.(Factory(B).Make)();
|
|
}
|
|
|
|
// --- fail_factory.impl.carbon
|
|
|
|
impl library "[[@TEST_NAME]]";
|
|
|
|
class C {}
|
|
|
|
fn MakeC(a: A) -> C {
|
|
// CHECK:STDERR: fail_factory.impl.carbon:[[@LINE+3]]:10: error: cannot access member of interface `Factory(C)` in type `A` that does not implement that interface [MissingImplInMemberAccess]
|
|
// CHECK:STDERR: return a.(Factory(C).Make)();
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
|
|
return a.(Factory(C).Make)();
|
|
}
|
|
|
|
// CHECK:STDOUT: --- action.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
|
|
// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
|
|
// CHECK:STDOUT: %Action.type.1: type = generic_interface_type @Action [template]
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
|
|
// CHECK:STDOUT: %Action.generic: %Action.type.1 = struct_value () [template]
|
|
// CHECK:STDOUT: %Action.type.2: type = facet_type <@Action, @Action(%T)> [symbolic]
|
|
// CHECK:STDOUT: %Self: %Action.type.2 = bind_symbolic_name Self, 1 [symbolic]
|
|
// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1, @Action(%T) [symbolic]
|
|
// CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [symbolic]
|
|
// CHECK:STDOUT: %Op.assoc_type.1: type = assoc_entity_type %Action.type.2, %Op.type.1 [symbolic]
|
|
// CHECK:STDOUT: %assoc0.1: %Op.assoc_type.1 = assoc_entity element0, @Action.%Op.decl [symbolic]
|
|
// CHECK:STDOUT: %A: type = class_type @A [template]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
|
|
// CHECK:STDOUT: %B: type = class_type @B [template]
|
|
// CHECK:STDOUT: %C: type = class_type @C [template]
|
|
// CHECK:STDOUT: %Action.type.3: type = facet_type <@Action, @Action(%B)> [template]
|
|
// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.2 [template]
|
|
// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template]
|
|
// CHECK:STDOUT: %Op.type.3: type = fn_type @Op.1, @Action(%B) [template]
|
|
// CHECK:STDOUT: %Op.3: %Op.type.3 = struct_value () [template]
|
|
// CHECK:STDOUT: %Op.assoc_type.2: type = assoc_entity_type %Action.type.3, %Op.type.3 [template]
|
|
// CHECK:STDOUT: %assoc0.2: %Op.assoc_type.2 = assoc_entity element0, @Action.%Op.decl [template]
|
|
// CHECK:STDOUT: %Action.facet: %Action.type.2 = facet_value %A, %A [symbolic]
|
|
// CHECK:STDOUT: %interface: <witness> = interface_witness (%Op.2) [template]
|
|
// CHECK:STDOUT: %F.type: type = fn_type @F [template]
|
|
// CHECK:STDOUT: %F: %F.type = struct_value () [template]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .Action = %Action.decl
|
|
// CHECK:STDOUT: .A = %A.decl
|
|
// CHECK:STDOUT: .B = %B.decl
|
|
// CHECK:STDOUT: .C = %C.decl
|
|
// CHECK:STDOUT: .F = %F.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Action.decl: %Action.type.1 = interface_decl @Action [template = constants.%Action.generic] {
|
|
// CHECK:STDOUT: %T.patt.loc4_18.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_18.2 (constants.%T.patt)]
|
|
// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc4_18.1, runtime_param<invalid> [symbolic = %T.patt.loc4_18.2 (constants.%T.patt)]
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
|
|
// CHECK:STDOUT: %T.loc4_18.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_18.2 (constants.%T)]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} {}
|
|
// CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} {}
|
|
// CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
|
|
// CHECK:STDOUT: impl_decl @impl [template] {} {
|
|
// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
|
|
// CHECK:STDOUT: %Action.ref: %Action.type.1 = name_ref Action, file.%Action.decl [template = constants.%Action.generic]
|
|
// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B]
|
|
// CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(constants.%B)> [template = constants.%Action.type.3]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
|
|
// CHECK:STDOUT: %a.patt: %A = binding_pattern a
|
|
// CHECK:STDOUT: %a.param_patt: %A = value_param_pattern %a.patt, runtime_param0
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
|
|
// CHECK:STDOUT: %a.param: %A = value_param runtime_param0
|
|
// CHECK:STDOUT: %a: %A = bind_name a, %a.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: generic interface @Action(%T.loc4_18.1: type) {
|
|
// CHECK:STDOUT: %T.loc4_18.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_18.2 (constants.%T)]
|
|
// CHECK:STDOUT: %T.patt.loc4_18.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_18.2 (constants.%T.patt)]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !definition:
|
|
// CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(%T.loc4_18.2)> [symbolic = %Action.type (constants.%Action.type.2)]
|
|
// CHECK:STDOUT: %Self.2: %Action.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)]
|
|
// CHECK:STDOUT: %Op.type: type = fn_type @Op.1, @Action(%T.loc4_18.2) [symbolic = %Op.type (constants.%Op.type.1)]
|
|
// CHECK:STDOUT: %Op: @Action.%Op.type (%Op.type.1) = struct_value () [symbolic = %Op (constants.%Op.1)]
|
|
// CHECK:STDOUT: %Op.assoc_type: type = assoc_entity_type @Action.%Action.type (%Action.type.2), @Action.%Op.type (%Op.type.1) [symbolic = %Op.assoc_type (constants.%Op.assoc_type.1)]
|
|
// CHECK:STDOUT: %assoc0.loc5_10.2: @Action.%Op.assoc_type (%Op.assoc_type.1) = assoc_entity element0, %Op.decl [symbolic = %assoc0.loc5_10.2 (constants.%assoc0.1)]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: interface {
|
|
// CHECK:STDOUT: %Self.1: @Action.%Action.type (%Action.type.2) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)]
|
|
// CHECK:STDOUT: %Op.decl: @Action.%Op.type (%Op.type.1) = fn_decl @Op.1 [symbolic = @Action.%Op (constants.%Op.1)] {} {}
|
|
// CHECK:STDOUT: %assoc0.loc5_10.1: @Action.%Op.assoc_type (%Op.assoc_type.1) = assoc_entity element0, %Op.decl [symbolic = %assoc0.loc5_10.2 (constants.%assoc0.1)]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = %Self.1
|
|
// CHECK:STDOUT: .Op = %assoc0.loc5_10.1
|
|
// CHECK:STDOUT: witness = (%Op.decl)
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: impl @impl: %A.ref as %Action.type {
|
|
// CHECK:STDOUT: %Op.decl: %Op.type.2 = fn_decl @Op.2 [template = constants.%Op.2] {} {}
|
|
// CHECK:STDOUT: %interface: <witness> = interface_witness (%Op.decl) [template = constants.%interface]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Op = %Op.decl
|
|
// CHECK:STDOUT: witness = %interface
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @A {
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%A
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @B {
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%B
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C {
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%C
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: generic fn @Op.1(@Action.%T.loc4_18.1: type, @Action.%Self.1: @Action.%Action.type (%Action.type.2)) {
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn();
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Op.2() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @F(%a.param_patt: %A) {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %a.ref: %A = name_ref a, %a
|
|
// CHECK:STDOUT: %Action.ref: %Action.type.1 = name_ref Action, file.%Action.decl [template = constants.%Action.generic]
|
|
// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B]
|
|
// CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(constants.%B)> [template = constants.%Action.type.3]
|
|
// CHECK:STDOUT: %.loc16: %Op.assoc_type.2 = specific_constant @Action.%assoc0.loc5_10.1, @Action(constants.%B) [template = constants.%assoc0.2]
|
|
// CHECK:STDOUT: %Op.ref: %Op.assoc_type.2 = name_ref Op, %.loc16 [template = constants.%assoc0.2]
|
|
// CHECK:STDOUT: %impl.elem0: %Op.type.3 = interface_witness_access constants.%interface, element0 [template = constants.%Op.2]
|
|
// CHECK:STDOUT: %Op.call: init %empty_tuple.type = call %impl.elem0()
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Action(constants.%T) {
|
|
// CHECK:STDOUT: %T.loc4_18.2 => constants.%T
|
|
// CHECK:STDOUT: %T.patt.loc4_18.2 => constants.%T
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Op.1(constants.%T, constants.%Self) {}
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Action(%T.loc4_18.2) {
|
|
// CHECK:STDOUT: %T.loc4_18.2 => constants.%T
|
|
// CHECK:STDOUT: %T.patt.loc4_18.2 => constants.%T
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Action(constants.%B) {
|
|
// CHECK:STDOUT: %T.loc4_18.2 => constants.%B
|
|
// CHECK:STDOUT: %T.patt.loc4_18.2 => constants.%B
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !definition:
|
|
// CHECK:STDOUT: %Action.type => constants.%Action.type.3
|
|
// CHECK:STDOUT: %Self.2 => constants.%Self
|
|
// CHECK:STDOUT: %Op.type => constants.%Op.type.3
|
|
// CHECK:STDOUT: %Op => constants.%Op.3
|
|
// CHECK:STDOUT: %Op.assoc_type => constants.%Op.assoc_type.2
|
|
// CHECK:STDOUT: %assoc0.loc5_10.2 => constants.%assoc0.2
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Op.1(constants.%B, constants.%Action.facet) {}
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- action.impl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %B: type = class_type @B [template]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
|
|
// CHECK:STDOUT: %Action.type.1: type = generic_interface_type @Action [template]
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
|
|
// CHECK:STDOUT: %Action.generic: %Action.type.1 = struct_value () [template]
|
|
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
|
|
// CHECK:STDOUT: %Action.type.2: type = facet_type <@Action, @Action(%T)> [symbolic]
|
|
// CHECK:STDOUT: %Self: %Action.type.2 = bind_symbolic_name Self, 1 [symbolic]
|
|
// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
|
|
// CHECK:STDOUT: %Action.type.3: type = facet_type <@Action, @Action(%B)> [template]
|
|
// CHECK:STDOUT: %A: type = class_type @A [template]
|
|
// CHECK:STDOUT: %Op.type.1: type = fn_type @Op.1, @Action(%T) [symbolic]
|
|
// CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [symbolic]
|
|
// CHECK:STDOUT: %Op.assoc_type.1: type = assoc_entity_type %Action.type.2, %Op.type.1 [symbolic]
|
|
// CHECK:STDOUT: %assoc0.1: %Op.assoc_type.1 = assoc_entity element0, imports.%import_ref.17 [symbolic]
|
|
// CHECK:STDOUT: %Op.type.2: type = fn_type @Op.1, @Action(%B) [template]
|
|
// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template]
|
|
// CHECK:STDOUT: %Op.assoc_type.2: type = assoc_entity_type %Action.type.3, %Op.type.2 [template]
|
|
// CHECK:STDOUT: %assoc0.2: %Op.assoc_type.2 = assoc_entity element0, imports.%import_ref.18 [template]
|
|
// CHECK:STDOUT: %G.type: type = fn_type @G [template]
|
|
// CHECK:STDOUT: %G: %G.type = struct_value () [template]
|
|
// CHECK:STDOUT: %assoc0.3: %Op.assoc_type.1 = assoc_entity element0, imports.%import_ref.19 [symbolic]
|
|
// CHECK:STDOUT: %Op.type.3: type = fn_type @Op.2 [template]
|
|
// CHECK:STDOUT: %Op.3: %Op.type.3 = struct_value () [template]
|
|
// CHECK:STDOUT: %interface: <witness> = interface_witness (%Op.3) [template]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %import_ref.1: %Action.type.1 = import_ref Main//action, inst+7, loaded [template = constants.%Action.generic]
|
|
// CHECK:STDOUT: %import_ref.2: type = import_ref Main//action, inst+28, loaded [template = constants.%A]
|
|
// CHECK:STDOUT: %import_ref.3: type = import_ref Main//action, inst+33, loaded [template = constants.%B]
|
|
// CHECK:STDOUT: %import_ref.4 = import_ref Main//action, inst+36, unloaded
|
|
// CHECK:STDOUT: %import_ref.5 = import_ref Main//action, inst+61, unloaded
|
|
// CHECK:STDOUT: %import_ref.6: <witness> = import_ref Main//action, inst+35, loaded [template = constants.%complete_type]
|
|
// CHECK:STDOUT: %import_ref.7 = import_ref Main//action, inst+34, unloaded
|
|
// CHECK:STDOUT: %import_ref.8 = import_ref Main//action, inst+14, unloaded
|
|
// CHECK:STDOUT: %import_ref.9: @Action.%Op.assoc_type (%Op.assoc_type.1) = import_ref Main//action, inst+20, loaded [symbolic = @Action.%assoc0 (constants.%assoc0.3)]
|
|
// CHECK:STDOUT: %import_ref.10 = import_ref Main//action, inst+16, unloaded
|
|
// CHECK:STDOUT: %import_ref.11: <witness> = import_ref Main//action, inst+31, loaded [template = constants.%complete_type]
|
|
// CHECK:STDOUT: %import_ref.12 = import_ref Main//action, inst+29, unloaded
|
|
// CHECK:STDOUT: %import_ref.13: type = import_ref Main//action, inst+39, loaded [template = constants.%A]
|
|
// CHECK:STDOUT: %import_ref.14: type = import_ref Main//action, inst+42, loaded [template = constants.%Action.type.3]
|
|
// CHECK:STDOUT: %import_ref.15: <witness> = import_ref Main//action, inst+53, loaded [template = constants.%interface]
|
|
// CHECK:STDOUT: %import_ref.16 = import_ref Main//action, inst+45, unloaded
|
|
// CHECK:STDOUT: %import_ref.17 = import_ref Main//action, inst+16, unloaded
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .Action = imports.%import_ref.1
|
|
// CHECK:STDOUT: .A = imports.%import_ref.2
|
|
// CHECK:STDOUT: .B = imports.%import_ref.3
|
|
// CHECK:STDOUT: .C = imports.%import_ref.4
|
|
// CHECK:STDOUT: .F = imports.%import_ref.5
|
|
// CHECK:STDOUT: .G = %G.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
|
|
// CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
|
|
// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
|
|
// CHECK:STDOUT: %a.patt: %A = binding_pattern a
|
|
// CHECK:STDOUT: %a.param_patt: %A = value_param_pattern %a.patt, runtime_param0
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %A.ref: type = name_ref A, imports.%import_ref.2 [template = constants.%A]
|
|
// CHECK:STDOUT: %a.param: %A = value_param runtime_param0
|
|
// CHECK:STDOUT: %a: %A = bind_name a, %a.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: generic interface @Action(constants.%T: type) {
|
|
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
|
|
// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !definition:
|
|
// CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(%T)> [symbolic = %Action.type (constants.%Action.type.2)]
|
|
// CHECK:STDOUT: %Self: %Action.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
|
|
// CHECK:STDOUT: %Op.type: type = fn_type @Op.1, @Action(%T) [symbolic = %Op.type (constants.%Op.type.1)]
|
|
// CHECK:STDOUT: %Op: @Action.%Op.type (%Op.type.1) = struct_value () [symbolic = %Op (constants.%Op.1)]
|
|
// CHECK:STDOUT: %Op.assoc_type: type = assoc_entity_type @Action.%Action.type (%Action.type.2), @Action.%Op.type (%Op.type.1) [symbolic = %Op.assoc_type (constants.%Op.assoc_type.1)]
|
|
// CHECK:STDOUT: %assoc0: @Action.%Op.assoc_type (%Op.assoc_type.1) = assoc_entity element0, imports.%import_ref.17 [symbolic = %assoc0 (constants.%assoc0.1)]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: interface {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = imports.%import_ref.8
|
|
// CHECK:STDOUT: .Op = imports.%import_ref.9
|
|
// CHECK:STDOUT: witness = (imports.%import_ref.10)
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: impl @impl: imports.%import_ref.13 as imports.%import_ref.14 {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Op = imports.%import_ref.16
|
|
// CHECK:STDOUT: witness = imports.%import_ref.15
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @B {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = imports.%import_ref.7
|
|
// CHECK:STDOUT: complete_type_witness = imports.%import_ref.6
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @A {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = imports.%import_ref.12
|
|
// CHECK:STDOUT: complete_type_witness = imports.%import_ref.11
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: generic fn @Op.1(constants.%T: type, constants.%Self: %Action.type.2) {
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn();
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @G(%a.param_patt: %A) {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %a.ref: %A = name_ref a, %a
|
|
// CHECK:STDOUT: %Action.ref: %Action.type.1 = name_ref Action, imports.%import_ref.1 [template = constants.%Action.generic]
|
|
// CHECK:STDOUT: %B.ref: type = name_ref B, imports.%import_ref.3 [template = constants.%B]
|
|
// CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(constants.%B)> [template = constants.%Action.type.3]
|
|
// CHECK:STDOUT: %.loc4: %Op.assoc_type.2 = specific_constant imports.%import_ref.9, @Action(constants.%B) [template = constants.%assoc0.2]
|
|
// CHECK:STDOUT: %Op.ref: %Op.assoc_type.2 = name_ref Op, %.loc4 [template = constants.%assoc0.2]
|
|
// CHECK:STDOUT: %impl.elem0: %Op.type.2 = interface_witness_access constants.%interface, element0 [template = constants.%Op.3]
|
|
// CHECK:STDOUT: %Op.call: init %empty_tuple.type = call %impl.elem0()
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Op.2();
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Action(constants.%T) {
|
|
// CHECK:STDOUT: %T => constants.%T
|
|
// CHECK:STDOUT: %T.patt => constants.%T
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Action(constants.%B) {
|
|
// CHECK:STDOUT: %T => constants.%B
|
|
// CHECK:STDOUT: %T.patt => constants.%B
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !definition:
|
|
// CHECK:STDOUT: %Action.type => constants.%Action.type.3
|
|
// CHECK:STDOUT: %Self => constants.%Self
|
|
// CHECK:STDOUT: %Op.type => constants.%Op.type.2
|
|
// CHECK:STDOUT: %Op => constants.%Op.2
|
|
// CHECK:STDOUT: %Op.assoc_type => constants.%Op.assoc_type.2
|
|
// CHECK:STDOUT: %assoc0 => constants.%assoc0.2
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Action(%T) {
|
|
// CHECK:STDOUT: %T => constants.%T
|
|
// CHECK:STDOUT: %T.patt => constants.%T
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Op.1(constants.%T, constants.%Self) {}
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_action.impl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %B: type = class_type @B [template]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
|
|
// CHECK:STDOUT: %Action.type.1: type = generic_interface_type @Action [template]
|
|
// CHECK:STDOUT: %Action.generic: %Action.type.1 = struct_value () [template]
|
|
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
|
|
// CHECK:STDOUT: %Action.type.2: type = facet_type <@Action, @Action(%T)> [symbolic]
|
|
// CHECK:STDOUT: %Self: %Action.type.2 = bind_symbolic_name Self, 1 [symbolic]
|
|
// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
|
|
// CHECK:STDOUT: %Action.type.3: type = facet_type <@Action, @Action(%B)> [template]
|
|
// CHECK:STDOUT: %A: type = class_type @A [template]
|
|
// CHECK:STDOUT: %Op.type.1: type = fn_type @Op, @Action(%T) [symbolic]
|
|
// CHECK:STDOUT: %Op.1: %Op.type.1 = struct_value () [symbolic]
|
|
// CHECK:STDOUT: %Op.assoc_type.1: type = assoc_entity_type %Action.type.2, %Op.type.1 [symbolic]
|
|
// CHECK:STDOUT: %assoc0.1: %Op.assoc_type.1 = assoc_entity element0, imports.%import_ref.17 [symbolic]
|
|
// CHECK:STDOUT: %Op.type.2: type = fn_type @Op, @Action(%B) [template]
|
|
// CHECK:STDOUT: %Op.2: %Op.type.2 = struct_value () [template]
|
|
// CHECK:STDOUT: %Op.assoc_type.2: type = assoc_entity_type %Action.type.3, %Op.type.2 [template]
|
|
// CHECK:STDOUT: %assoc0.2: %Op.assoc_type.2 = assoc_entity element0, imports.%import_ref.18 [template]
|
|
// CHECK:STDOUT: %G.type: type = fn_type @G [template]
|
|
// CHECK:STDOUT: %G: %G.type = struct_value () [template]
|
|
// CHECK:STDOUT: %C: type = class_type @C [template]
|
|
// CHECK:STDOUT: %Action.type.4: type = facet_type <@Action, @Action(%C)> [template]
|
|
// CHECK:STDOUT: %Op.type.3: type = fn_type @Op, @Action(%C) [template]
|
|
// CHECK:STDOUT: %Op.3: %Op.type.3 = struct_value () [template]
|
|
// CHECK:STDOUT: %Op.assoc_type.3: type = assoc_entity_type %Action.type.4, %Op.type.3 [template]
|
|
// CHECK:STDOUT: %assoc0.3: %Op.assoc_type.3 = assoc_entity element0, imports.%import_ref.17 [template]
|
|
// CHECK:STDOUT: %assoc0.4: %Op.assoc_type.1 = assoc_entity element0, imports.%import_ref.21 [symbolic]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %import_ref.1: %Action.type.1 = import_ref Main//action, inst+7, loaded [template = constants.%Action.generic]
|
|
// CHECK:STDOUT: %import_ref.2: type = import_ref Main//action, inst+28, loaded [template = constants.%A]
|
|
// CHECK:STDOUT: %import_ref.3 = import_ref Main//action, inst+33, unloaded
|
|
// CHECK:STDOUT: %import_ref.4: type = import_ref Main//action, inst+36, loaded [template = constants.%C]
|
|
// CHECK:STDOUT: %import_ref.5 = import_ref Main//action, inst+61, unloaded
|
|
// CHECK:STDOUT: %import_ref.6: <witness> = import_ref Main//action, inst+35, loaded [template = constants.%complete_type]
|
|
// CHECK:STDOUT: %import_ref.7 = import_ref Main//action, inst+34, unloaded
|
|
// CHECK:STDOUT: %import_ref.8 = import_ref Main//action, inst+14, unloaded
|
|
// CHECK:STDOUT: %import_ref.9: @Action.%Op.assoc_type (%Op.assoc_type.1) = import_ref Main//action, inst+20, loaded [symbolic = @Action.%assoc0 (constants.%assoc0.4)]
|
|
// CHECK:STDOUT: %import_ref.10 = import_ref Main//action, inst+16, unloaded
|
|
// CHECK:STDOUT: %import_ref.11: <witness> = import_ref Main//action, inst+31, loaded [template = constants.%complete_type]
|
|
// CHECK:STDOUT: %import_ref.12 = import_ref Main//action, inst+29, unloaded
|
|
// CHECK:STDOUT: %import_ref.13: type = import_ref Main//action, inst+39, loaded [template = constants.%A]
|
|
// CHECK:STDOUT: %import_ref.14: type = import_ref Main//action, inst+42, loaded [template = constants.%Action.type.3]
|
|
// CHECK:STDOUT: %import_ref.15 = import_ref Main//action, inst+53, unloaded
|
|
// CHECK:STDOUT: %import_ref.16 = import_ref Main//action, inst+45, unloaded
|
|
// CHECK:STDOUT: %import_ref.17 = import_ref Main//action, inst+16, unloaded
|
|
// CHECK:STDOUT: %import_ref.19: <witness> = import_ref Main//action, inst+38, loaded [template = constants.%complete_type]
|
|
// CHECK:STDOUT: %import_ref.20 = import_ref Main//action, inst+37, unloaded
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .Action = imports.%import_ref.1
|
|
// CHECK:STDOUT: .A = imports.%import_ref.2
|
|
// CHECK:STDOUT: .B = imports.%import_ref.3
|
|
// CHECK:STDOUT: .C = imports.%import_ref.4
|
|
// CHECK:STDOUT: .F = imports.%import_ref.5
|
|
// CHECK:STDOUT: .G = %G.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
|
|
// CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
|
|
// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
|
|
// CHECK:STDOUT: %a.patt: %A = binding_pattern a
|
|
// CHECK:STDOUT: %a.param_patt: %A = value_param_pattern %a.patt, runtime_param0
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %A.ref: type = name_ref A, imports.%import_ref.2 [template = constants.%A]
|
|
// CHECK:STDOUT: %a.param: %A = value_param runtime_param0
|
|
// CHECK:STDOUT: %a: %A = bind_name a, %a.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: generic interface @Action(constants.%T: type) {
|
|
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
|
|
// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !definition:
|
|
// CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(%T)> [symbolic = %Action.type (constants.%Action.type.2)]
|
|
// CHECK:STDOUT: %Self: %Action.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
|
|
// CHECK:STDOUT: %Op.type: type = fn_type @Op, @Action(%T) [symbolic = %Op.type (constants.%Op.type.1)]
|
|
// CHECK:STDOUT: %Op: @Action.%Op.type (%Op.type.1) = struct_value () [symbolic = %Op (constants.%Op.1)]
|
|
// CHECK:STDOUT: %Op.assoc_type: type = assoc_entity_type @Action.%Action.type (%Action.type.2), @Action.%Op.type (%Op.type.1) [symbolic = %Op.assoc_type (constants.%Op.assoc_type.1)]
|
|
// CHECK:STDOUT: %assoc0: @Action.%Op.assoc_type (%Op.assoc_type.1) = assoc_entity element0, imports.%import_ref.17 [symbolic = %assoc0 (constants.%assoc0.1)]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: interface {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = imports.%import_ref.8
|
|
// CHECK:STDOUT: .Op = imports.%import_ref.9
|
|
// CHECK:STDOUT: witness = (imports.%import_ref.10)
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: impl @impl: imports.%import_ref.13 as imports.%import_ref.14 {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Op = imports.%import_ref.16
|
|
// CHECK:STDOUT: witness = imports.%import_ref.15
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @B {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = imports.%import_ref.7
|
|
// CHECK:STDOUT: complete_type_witness = imports.%import_ref.6
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @A {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = imports.%import_ref.12
|
|
// CHECK:STDOUT: complete_type_witness = imports.%import_ref.11
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = imports.%import_ref.20
|
|
// CHECK:STDOUT: complete_type_witness = imports.%import_ref.19
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: generic fn @Op(constants.%T: type, constants.%Self: %Action.type.2) {
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn();
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @G(%a.param_patt: %A) {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %a.ref: %A = name_ref a, %a
|
|
// CHECK:STDOUT: %Action.ref: %Action.type.1 = name_ref Action, imports.%import_ref.1 [template = constants.%Action.generic]
|
|
// CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.4 [template = constants.%C]
|
|
// CHECK:STDOUT: %Action.type: type = facet_type <@Action, @Action(constants.%C)> [template = constants.%Action.type.4]
|
|
// CHECK:STDOUT: %.loc8: %Op.assoc_type.3 = specific_constant imports.%import_ref.9, @Action(constants.%C) [template = constants.%assoc0.3]
|
|
// CHECK:STDOUT: %Op.ref: %Op.assoc_type.3 = name_ref Op, %.loc8 [template = constants.%assoc0.3]
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Action(constants.%T) {
|
|
// CHECK:STDOUT: %T => constants.%T
|
|
// CHECK:STDOUT: %T.patt => constants.%T
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Action(constants.%B) {
|
|
// CHECK:STDOUT: %T => constants.%B
|
|
// CHECK:STDOUT: %T.patt => constants.%B
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !definition:
|
|
// CHECK:STDOUT: %Action.type => constants.%Action.type.3
|
|
// CHECK:STDOUT: %Self => constants.%Self
|
|
// CHECK:STDOUT: %Op.type => constants.%Op.type.2
|
|
// CHECK:STDOUT: %Op => constants.%Op.2
|
|
// CHECK:STDOUT: %Op.assoc_type => constants.%Op.assoc_type.2
|
|
// CHECK:STDOUT: %assoc0 => constants.%assoc0.2
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Action(%T) {
|
|
// CHECK:STDOUT: %T => constants.%T
|
|
// CHECK:STDOUT: %T.patt => constants.%T
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Op(constants.%T, constants.%Self) {}
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Action(constants.%C) {
|
|
// CHECK:STDOUT: %T => constants.%C
|
|
// CHECK:STDOUT: %T.patt => constants.%C
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !definition:
|
|
// CHECK:STDOUT: %Action.type => constants.%Action.type.4
|
|
// CHECK:STDOUT: %Self => constants.%Self
|
|
// CHECK:STDOUT: %Op.type => constants.%Op.type.3
|
|
// CHECK:STDOUT: %Op => constants.%Op.3
|
|
// CHECK:STDOUT: %Op.assoc_type => constants.%Op.assoc_type.3
|
|
// CHECK:STDOUT: %assoc0 => constants.%assoc0.3
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- factory.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
|
|
// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
|
|
// CHECK:STDOUT: %Factory.type.1: type = generic_interface_type @Factory [template]
|
|
// CHECK:STDOUT: %Factory.generic: %Factory.type.1 = struct_value () [template]
|
|
// CHECK:STDOUT: %Factory.type.2: type = facet_type <@Factory, @Factory(%T)> [symbolic]
|
|
// CHECK:STDOUT: %Self: %Factory.type.2 = bind_symbolic_name Self, 1 [symbolic]
|
|
// CHECK:STDOUT: %Make.type.1: type = fn_type @Make.1, @Factory(%T) [symbolic]
|
|
// CHECK:STDOUT: %Make.1: %Make.type.1 = struct_value () [symbolic]
|
|
// CHECK:STDOUT: %Make.assoc_type.1: type = assoc_entity_type %Factory.type.2, %Make.type.1 [symbolic]
|
|
// CHECK:STDOUT: %assoc0.1: %Make.assoc_type.1 = assoc_entity element0, @Factory.%Make.decl [symbolic]
|
|
// CHECK:STDOUT: %A: type = class_type @A [template]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
|
|
// CHECK:STDOUT: %B: type = class_type @B [template]
|
|
// CHECK:STDOUT: %Factory.type.3: type = facet_type <@Factory, @Factory(%B)> [template]
|
|
// CHECK:STDOUT: %Make.type.2: type = fn_type @Make.2 [template]
|
|
// CHECK:STDOUT: %Make.2: %Make.type.2 = struct_value () [template]
|
|
// CHECK:STDOUT: %Make.type.3: type = fn_type @Make.1, @Factory(%B) [template]
|
|
// CHECK:STDOUT: %Make.3: %Make.type.3 = struct_value () [template]
|
|
// CHECK:STDOUT: %Make.assoc_type.2: type = assoc_entity_type %Factory.type.3, %Make.type.3 [template]
|
|
// CHECK:STDOUT: %assoc0.2: %Make.assoc_type.2 = assoc_entity element0, @Factory.%Make.decl [template]
|
|
// CHECK:STDOUT: %Factory.facet: %Factory.type.2 = facet_value %A, %A [symbolic]
|
|
// CHECK:STDOUT: %interface: <witness> = interface_witness (%Make.2) [template]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .Factory = %Factory.decl
|
|
// CHECK:STDOUT: .A = %A.decl
|
|
// CHECK:STDOUT: .B = %B.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Factory.decl: %Factory.type.1 = interface_decl @Factory [template = constants.%Factory.generic] {
|
|
// CHECK:STDOUT: %T.patt.loc4_19.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_19.2 (constants.%T.patt)]
|
|
// CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc4_19.1, runtime_param<invalid> [symbolic = %T.patt.loc4_19.2 (constants.%T.patt)]
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
|
|
// CHECK:STDOUT: %T.loc4_19.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_19.2 (constants.%T)]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} {}
|
|
// CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} {}
|
|
// CHECK:STDOUT: impl_decl @impl [template] {} {
|
|
// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
|
|
// CHECK:STDOUT: %Factory.ref: %Factory.type.1 = name_ref Factory, file.%Factory.decl [template = constants.%Factory.generic]
|
|
// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B]
|
|
// CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%B)> [template = constants.%Factory.type.3]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: generic interface @Factory(%T.loc4_19.1: type) {
|
|
// CHECK:STDOUT: %T.loc4_19.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_19.2 (constants.%T)]
|
|
// CHECK:STDOUT: %T.patt.loc4_19.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_19.2 (constants.%T.patt)]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !definition:
|
|
// CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T.loc4_19.2)> [symbolic = %Factory.type (constants.%Factory.type.2)]
|
|
// CHECK:STDOUT: %Self.2: %Factory.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)]
|
|
// CHECK:STDOUT: %Make.type: type = fn_type @Make.1, @Factory(%T.loc4_19.2) [symbolic = %Make.type (constants.%Make.type.1)]
|
|
// CHECK:STDOUT: %Make: @Factory.%Make.type (%Make.type.1) = struct_value () [symbolic = %Make (constants.%Make.1)]
|
|
// CHECK:STDOUT: %Make.assoc_type: type = assoc_entity_type @Factory.%Factory.type (%Factory.type.2), @Factory.%Make.type (%Make.type.1) [symbolic = %Make.assoc_type (constants.%Make.assoc_type.1)]
|
|
// CHECK:STDOUT: %assoc0.loc5_17.2: @Factory.%Make.assoc_type (%Make.assoc_type.1) = assoc_entity element0, %Make.decl [symbolic = %assoc0.loc5_17.2 (constants.%assoc0.1)]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: interface {
|
|
// CHECK:STDOUT: %Self.1: @Factory.%Factory.type (%Factory.type.2) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)]
|
|
// CHECK:STDOUT: %Make.decl: @Factory.%Make.type (%Make.type.1) = fn_decl @Make.1 [symbolic = @Factory.%Make (constants.%Make.1)] {
|
|
// CHECK:STDOUT: %return.patt: @Make.1.%T (%T) = return_slot_pattern
|
|
// CHECK:STDOUT: %return.param_patt: @Make.1.%T (%T) = out_param_pattern %return.patt, runtime_param0
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %T.ref: type = name_ref T, @Factory.%T.loc4_19.1 [symbolic = %T (constants.%T)]
|
|
// CHECK:STDOUT: %return.param: ref @Make.1.%T (%T) = out_param runtime_param0
|
|
// CHECK:STDOUT: %return: ref @Make.1.%T (%T) = return_slot %return.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %assoc0.loc5_17.1: @Factory.%Make.assoc_type (%Make.assoc_type.1) = assoc_entity element0, %Make.decl [symbolic = %assoc0.loc5_17.2 (constants.%assoc0.1)]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = %Self.1
|
|
// CHECK:STDOUT: .Make = %assoc0.loc5_17.1
|
|
// CHECK:STDOUT: witness = (%Make.decl)
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: impl @impl: %A.ref as %Factory.type {
|
|
// CHECK:STDOUT: %Make.decl: %Make.type.2 = fn_decl @Make.2 [template = constants.%Make.2] {
|
|
// CHECK:STDOUT: %return.patt: %B = return_slot_pattern
|
|
// CHECK:STDOUT: %return.param_patt: %B = out_param_pattern %return.patt, runtime_param0
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B]
|
|
// CHECK:STDOUT: %return.param: ref %B = out_param runtime_param0
|
|
// CHECK:STDOUT: %return: ref %B = return_slot %return.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %interface: <witness> = interface_witness (%Make.decl) [template = constants.%interface]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Make = %Make.decl
|
|
// CHECK:STDOUT: witness = %interface
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @A {
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%A
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @B {
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%B
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: generic fn @Make.1(@Factory.%T.loc4_19.1: type, @Factory.%Self.1: @Factory.%Factory.type (%Factory.type.2)) {
|
|
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn() -> @Make.1.%T (%T);
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Make.2() -> %B;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Factory(constants.%T) {
|
|
// CHECK:STDOUT: %T.loc4_19.2 => constants.%T
|
|
// CHECK:STDOUT: %T.patt.loc4_19.2 => constants.%T
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Make.1(constants.%T, constants.%Self) {
|
|
// CHECK:STDOUT: %T => constants.%T
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Factory(%T.loc4_19.2) {
|
|
// CHECK:STDOUT: %T.loc4_19.2 => constants.%T
|
|
// CHECK:STDOUT: %T.patt.loc4_19.2 => constants.%T
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Factory(constants.%B) {
|
|
// CHECK:STDOUT: %T.loc4_19.2 => constants.%B
|
|
// CHECK:STDOUT: %T.patt.loc4_19.2 => constants.%B
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !definition:
|
|
// CHECK:STDOUT: %Factory.type => constants.%Factory.type.3
|
|
// CHECK:STDOUT: %Self.2 => constants.%Self
|
|
// CHECK:STDOUT: %Make.type => constants.%Make.type.3
|
|
// CHECK:STDOUT: %Make => constants.%Make.3
|
|
// CHECK:STDOUT: %Make.assoc_type => constants.%Make.assoc_type.2
|
|
// CHECK:STDOUT: %assoc0.loc5_17.2 => constants.%assoc0.2
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Make.1(constants.%B, constants.%Factory.facet) {
|
|
// CHECK:STDOUT: %T => constants.%B
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- factory.impl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %B: type = class_type @B [template]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
|
|
// CHECK:STDOUT: %Factory.type.1: type = generic_interface_type @Factory [template]
|
|
// CHECK:STDOUT: %Factory.generic: %Factory.type.1 = struct_value () [template]
|
|
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
|
|
// CHECK:STDOUT: %Factory.type.2: type = facet_type <@Factory, @Factory(%T)> [symbolic]
|
|
// CHECK:STDOUT: %Self: %Factory.type.2 = bind_symbolic_name Self, 1 [symbolic]
|
|
// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
|
|
// CHECK:STDOUT: %Factory.type.3: type = facet_type <@Factory, @Factory(%B)> [template]
|
|
// CHECK:STDOUT: %A: type = class_type @A [template]
|
|
// CHECK:STDOUT: %Make.type.1: type = fn_type @Make.1, @Factory(%T) [symbolic]
|
|
// CHECK:STDOUT: %Make.1: %Make.type.1 = struct_value () [symbolic]
|
|
// CHECK:STDOUT: %Make.assoc_type.1: type = assoc_entity_type %Factory.type.2, %Make.type.1 [symbolic]
|
|
// CHECK:STDOUT: %assoc0.1: %Make.assoc_type.1 = assoc_entity element0, imports.%import_ref.15 [symbolic]
|
|
// CHECK:STDOUT: %Make.type.2: type = fn_type @Make.1, @Factory(%B) [template]
|
|
// CHECK:STDOUT: %Make.2: %Make.type.2 = struct_value () [template]
|
|
// CHECK:STDOUT: %Make.assoc_type.2: type = assoc_entity_type %Factory.type.3, %Make.type.2 [template]
|
|
// CHECK:STDOUT: %assoc0.2: %Make.assoc_type.2 = assoc_entity element0, imports.%import_ref.16 [template]
|
|
// CHECK:STDOUT: %MakeB.type: type = fn_type @MakeB [template]
|
|
// CHECK:STDOUT: %MakeB: %MakeB.type = struct_value () [template]
|
|
// CHECK:STDOUT: %assoc0.3: %Make.assoc_type.1 = assoc_entity element0, imports.%import_ref.17 [symbolic]
|
|
// CHECK:STDOUT: %Make.type.3: type = fn_type @Make.2 [template]
|
|
// CHECK:STDOUT: %Make.3: %Make.type.3 = struct_value () [template]
|
|
// CHECK:STDOUT: %interface: <witness> = interface_witness (%Make.3) [template]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %import_ref.1: %Factory.type.1 = import_ref Main//factory, inst+7, loaded [template = constants.%Factory.generic]
|
|
// CHECK:STDOUT: %import_ref.2: type = import_ref Main//factory, inst+34, loaded [template = constants.%A]
|
|
// CHECK:STDOUT: %import_ref.3: type = import_ref Main//factory, inst+39, loaded [template = constants.%B]
|
|
// CHECK:STDOUT: %import_ref.4: <witness> = import_ref Main//factory, inst+41, loaded [template = constants.%complete_type]
|
|
// CHECK:STDOUT: %import_ref.5 = import_ref Main//factory, inst+40, unloaded
|
|
// CHECK:STDOUT: %import_ref.6 = import_ref Main//factory, inst+14, unloaded
|
|
// CHECK:STDOUT: %import_ref.7: @Factory.%Make.assoc_type (%Make.assoc_type.1) = import_ref Main//factory, inst+26, loaded [symbolic = @Factory.%assoc0 (constants.%assoc0.3)]
|
|
// CHECK:STDOUT: %import_ref.8 = import_ref Main//factory, inst+21, unloaded
|
|
// CHECK:STDOUT: %import_ref.9: <witness> = import_ref Main//factory, inst+37, loaded [template = constants.%complete_type]
|
|
// CHECK:STDOUT: %import_ref.10 = import_ref Main//factory, inst+35, unloaded
|
|
// CHECK:STDOUT: %import_ref.11: type = import_ref Main//factory, inst+42, loaded [template = constants.%A]
|
|
// CHECK:STDOUT: %import_ref.12: type = import_ref Main//factory, inst+45, loaded [template = constants.%Factory.type.3]
|
|
// CHECK:STDOUT: %import_ref.13: <witness> = import_ref Main//factory, inst+61, loaded [template = constants.%interface]
|
|
// CHECK:STDOUT: %import_ref.14 = import_ref Main//factory, inst+53, unloaded
|
|
// CHECK:STDOUT: %import_ref.15 = import_ref Main//factory, inst+21, unloaded
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .Factory = imports.%import_ref.1
|
|
// CHECK:STDOUT: .A = imports.%import_ref.2
|
|
// CHECK:STDOUT: .B = imports.%import_ref.3
|
|
// CHECK:STDOUT: .MakeB = %MakeB.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
|
|
// CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
|
|
// CHECK:STDOUT: %MakeB.decl: %MakeB.type = fn_decl @MakeB [template = constants.%MakeB] {
|
|
// CHECK:STDOUT: %a.patt: %A = binding_pattern a
|
|
// CHECK:STDOUT: %a.param_patt: %A = value_param_pattern %a.patt, runtime_param0
|
|
// CHECK:STDOUT: %return.patt: %B = return_slot_pattern
|
|
// CHECK:STDOUT: %return.param_patt: %B = out_param_pattern %return.patt, runtime_param1
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %A.ref: type = name_ref A, imports.%import_ref.2 [template = constants.%A]
|
|
// CHECK:STDOUT: %B.ref.loc4: type = name_ref B, imports.%import_ref.3 [template = constants.%B]
|
|
// CHECK:STDOUT: %a.param: %A = value_param runtime_param0
|
|
// CHECK:STDOUT: %a: %A = bind_name a, %a.param
|
|
// CHECK:STDOUT: %return.param: ref %B = out_param runtime_param1
|
|
// CHECK:STDOUT: %return: ref %B = return_slot %return.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: generic interface @Factory(constants.%T: type) {
|
|
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
|
|
// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !definition:
|
|
// CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.2)]
|
|
// CHECK:STDOUT: %Self: %Factory.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
|
|
// CHECK:STDOUT: %Make.type: type = fn_type @Make.1, @Factory(%T) [symbolic = %Make.type (constants.%Make.type.1)]
|
|
// CHECK:STDOUT: %Make: @Factory.%Make.type (%Make.type.1) = struct_value () [symbolic = %Make (constants.%Make.1)]
|
|
// CHECK:STDOUT: %Make.assoc_type: type = assoc_entity_type @Factory.%Factory.type (%Factory.type.2), @Factory.%Make.type (%Make.type.1) [symbolic = %Make.assoc_type (constants.%Make.assoc_type.1)]
|
|
// CHECK:STDOUT: %assoc0: @Factory.%Make.assoc_type (%Make.assoc_type.1) = assoc_entity element0, imports.%import_ref.15 [symbolic = %assoc0 (constants.%assoc0.1)]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: interface {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = imports.%import_ref.6
|
|
// CHECK:STDOUT: .Make = imports.%import_ref.7
|
|
// CHECK:STDOUT: witness = (imports.%import_ref.8)
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: impl @impl: imports.%import_ref.11 as imports.%import_ref.12 {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Make = imports.%import_ref.14
|
|
// CHECK:STDOUT: witness = imports.%import_ref.13
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @B {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = imports.%import_ref.5
|
|
// CHECK:STDOUT: complete_type_witness = imports.%import_ref.4
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @A {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = imports.%import_ref.10
|
|
// CHECK:STDOUT: complete_type_witness = imports.%import_ref.9
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: generic fn @Make.1(constants.%T: type, constants.%Self: %Factory.type.2) {
|
|
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn() -> @Make.1.%T (%T);
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @MakeB(%a.param_patt: %A) -> %return: %B {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %a.ref: %A = name_ref a, %a
|
|
// CHECK:STDOUT: %Factory.ref: %Factory.type.1 = name_ref Factory, imports.%import_ref.1 [template = constants.%Factory.generic]
|
|
// CHECK:STDOUT: %B.ref.loc5: type = name_ref B, imports.%import_ref.3 [template = constants.%B]
|
|
// CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%B)> [template = constants.%Factory.type.3]
|
|
// CHECK:STDOUT: %.loc5: %Make.assoc_type.2 = specific_constant imports.%import_ref.7, @Factory(constants.%B) [template = constants.%assoc0.2]
|
|
// CHECK:STDOUT: %Make.ref: %Make.assoc_type.2 = name_ref Make, %.loc5 [template = constants.%assoc0.2]
|
|
// CHECK:STDOUT: %impl.elem0: %Make.type.2 = interface_witness_access constants.%interface, element0 [template = constants.%Make.3]
|
|
// CHECK:STDOUT: %.loc4_16.2: ref %B = splice_block %return {}
|
|
// CHECK:STDOUT: %Make.call: init %B = call %impl.elem0() to %.loc4_16.2
|
|
// CHECK:STDOUT: return %Make.call to %return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Make.2() -> %B;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Factory(constants.%T) {
|
|
// CHECK:STDOUT: %T => constants.%T
|
|
// CHECK:STDOUT: %T.patt => constants.%T
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Factory(constants.%B) {
|
|
// CHECK:STDOUT: %T => constants.%B
|
|
// CHECK:STDOUT: %T.patt => constants.%B
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !definition:
|
|
// CHECK:STDOUT: %Factory.type => constants.%Factory.type.3
|
|
// CHECK:STDOUT: %Self => constants.%Self
|
|
// CHECK:STDOUT: %Make.type => constants.%Make.type.2
|
|
// CHECK:STDOUT: %Make => constants.%Make.2
|
|
// CHECK:STDOUT: %Make.assoc_type => constants.%Make.assoc_type.2
|
|
// CHECK:STDOUT: %assoc0 => constants.%assoc0.2
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Factory(%T) {
|
|
// CHECK:STDOUT: %T => constants.%T
|
|
// CHECK:STDOUT: %T.patt => constants.%T
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Make.1(constants.%T, constants.%Self) {
|
|
// CHECK:STDOUT: %T => constants.%T
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_factory.impl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %B: type = class_type @B [template]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
|
|
// CHECK:STDOUT: %Factory.type.1: type = generic_interface_type @Factory [template]
|
|
// CHECK:STDOUT: %Factory.generic: %Factory.type.1 = struct_value () [template]
|
|
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
|
|
// CHECK:STDOUT: %Factory.type.2: type = facet_type <@Factory, @Factory(%T)> [symbolic]
|
|
// CHECK:STDOUT: %Self: %Factory.type.2 = bind_symbolic_name Self, 1 [symbolic]
|
|
// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
|
|
// CHECK:STDOUT: %Factory.type.3: type = facet_type <@Factory, @Factory(%B)> [template]
|
|
// CHECK:STDOUT: %A: type = class_type @A [template]
|
|
// CHECK:STDOUT: %Make.type.1: type = fn_type @Make, @Factory(%T) [symbolic]
|
|
// CHECK:STDOUT: %Make.1: %Make.type.1 = struct_value () [symbolic]
|
|
// CHECK:STDOUT: %Make.assoc_type.1: type = assoc_entity_type %Factory.type.2, %Make.type.1 [symbolic]
|
|
// CHECK:STDOUT: %assoc0.1: %Make.assoc_type.1 = assoc_entity element0, imports.%import_ref.15 [symbolic]
|
|
// CHECK:STDOUT: %Make.type.2: type = fn_type @Make, @Factory(%B) [template]
|
|
// CHECK:STDOUT: %Make.2: %Make.type.2 = struct_value () [template]
|
|
// CHECK:STDOUT: %Make.assoc_type.2: type = assoc_entity_type %Factory.type.3, %Make.type.2 [template]
|
|
// CHECK:STDOUT: %assoc0.2: %Make.assoc_type.2 = assoc_entity element0, imports.%import_ref.16 [template]
|
|
// CHECK:STDOUT: %C: type = class_type @C [template]
|
|
// CHECK:STDOUT: %MakeC.type: type = fn_type @MakeC [template]
|
|
// CHECK:STDOUT: %MakeC: %MakeC.type = struct_value () [template]
|
|
// CHECK:STDOUT: %Factory.type.4: type = facet_type <@Factory, @Factory(%C)> [template]
|
|
// CHECK:STDOUT: %Make.type.3: type = fn_type @Make, @Factory(%C) [template]
|
|
// CHECK:STDOUT: %Make.3: %Make.type.3 = struct_value () [template]
|
|
// CHECK:STDOUT: %Make.assoc_type.3: type = assoc_entity_type %Factory.type.4, %Make.type.3 [template]
|
|
// CHECK:STDOUT: %assoc0.3: %Make.assoc_type.3 = assoc_entity element0, imports.%import_ref.15 [template]
|
|
// CHECK:STDOUT: %assoc0.4: %Make.assoc_type.1 = assoc_entity element0, imports.%import_ref.17 [symbolic]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %import_ref.1: %Factory.type.1 = import_ref Main//factory, inst+7, loaded [template = constants.%Factory.generic]
|
|
// CHECK:STDOUT: %import_ref.2: type = import_ref Main//factory, inst+34, loaded [template = constants.%A]
|
|
// CHECK:STDOUT: %import_ref.3 = import_ref Main//factory, inst+39, unloaded
|
|
// CHECK:STDOUT: %import_ref.4: <witness> = import_ref Main//factory, inst+41, loaded [template = constants.%complete_type]
|
|
// CHECK:STDOUT: %import_ref.5 = import_ref Main//factory, inst+40, unloaded
|
|
// CHECK:STDOUT: %import_ref.6 = import_ref Main//factory, inst+14, unloaded
|
|
// CHECK:STDOUT: %import_ref.7: @Factory.%Make.assoc_type (%Make.assoc_type.1) = import_ref Main//factory, inst+26, loaded [symbolic = @Factory.%assoc0 (constants.%assoc0.4)]
|
|
// CHECK:STDOUT: %import_ref.8 = import_ref Main//factory, inst+21, unloaded
|
|
// CHECK:STDOUT: %import_ref.9: <witness> = import_ref Main//factory, inst+37, loaded [template = constants.%complete_type]
|
|
// CHECK:STDOUT: %import_ref.10 = import_ref Main//factory, inst+35, unloaded
|
|
// CHECK:STDOUT: %import_ref.11: type = import_ref Main//factory, inst+42, loaded [template = constants.%A]
|
|
// CHECK:STDOUT: %import_ref.12: type = import_ref Main//factory, inst+45, loaded [template = constants.%Factory.type.3]
|
|
// CHECK:STDOUT: %import_ref.13 = import_ref Main//factory, inst+61, unloaded
|
|
// CHECK:STDOUT: %import_ref.14 = import_ref Main//factory, inst+53, unloaded
|
|
// CHECK:STDOUT: %import_ref.15 = import_ref Main//factory, inst+21, unloaded
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .Factory = imports.%import_ref.1
|
|
// CHECK:STDOUT: .A = imports.%import_ref.2
|
|
// CHECK:STDOUT: .B = imports.%import_ref.3
|
|
// CHECK:STDOUT: .C = %C.decl
|
|
// CHECK:STDOUT: .MakeC = %MakeC.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
|
|
// CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
|
|
// CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
|
|
// CHECK:STDOUT: %MakeC.decl: %MakeC.type = fn_decl @MakeC [template = constants.%MakeC] {
|
|
// CHECK:STDOUT: %a.patt: %A = binding_pattern a
|
|
// CHECK:STDOUT: %a.param_patt: %A = value_param_pattern %a.patt, runtime_param0
|
|
// CHECK:STDOUT: %return.patt: %C = return_slot_pattern
|
|
// CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param1
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %A.ref: type = name_ref A, imports.%import_ref.2 [template = constants.%A]
|
|
// CHECK:STDOUT: %C.ref.loc6: type = name_ref C, file.%C.decl [template = constants.%C]
|
|
// CHECK:STDOUT: %a.param: %A = value_param runtime_param0
|
|
// CHECK:STDOUT: %a: %A = bind_name a, %a.param
|
|
// CHECK:STDOUT: %return.param: ref %C = out_param runtime_param1
|
|
// CHECK:STDOUT: %return: ref %C = return_slot %return.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: generic interface @Factory(constants.%T: type) {
|
|
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
|
|
// CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !definition:
|
|
// CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(%T)> [symbolic = %Factory.type (constants.%Factory.type.2)]
|
|
// CHECK:STDOUT: %Self: %Factory.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
|
|
// CHECK:STDOUT: %Make.type: type = fn_type @Make, @Factory(%T) [symbolic = %Make.type (constants.%Make.type.1)]
|
|
// CHECK:STDOUT: %Make: @Factory.%Make.type (%Make.type.1) = struct_value () [symbolic = %Make (constants.%Make.1)]
|
|
// CHECK:STDOUT: %Make.assoc_type: type = assoc_entity_type @Factory.%Factory.type (%Factory.type.2), @Factory.%Make.type (%Make.type.1) [symbolic = %Make.assoc_type (constants.%Make.assoc_type.1)]
|
|
// CHECK:STDOUT: %assoc0: @Factory.%Make.assoc_type (%Make.assoc_type.1) = assoc_entity element0, imports.%import_ref.15 [symbolic = %assoc0 (constants.%assoc0.1)]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: interface {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = imports.%import_ref.6
|
|
// CHECK:STDOUT: .Make = imports.%import_ref.7
|
|
// CHECK:STDOUT: witness = (imports.%import_ref.8)
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: impl @impl: imports.%import_ref.11 as imports.%import_ref.12 {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Make = imports.%import_ref.14
|
|
// CHECK:STDOUT: witness = imports.%import_ref.13
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @B {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = imports.%import_ref.5
|
|
// CHECK:STDOUT: complete_type_witness = imports.%import_ref.4
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @A {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = imports.%import_ref.10
|
|
// CHECK:STDOUT: complete_type_witness = imports.%import_ref.9
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C {
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%C
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: generic fn @Make(constants.%T: type, constants.%Self: %Factory.type.2) {
|
|
// CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn() -> @Make.%T (%T);
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @MakeC(%a.param_patt: %A) -> %return: %C {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %a.ref: %A = name_ref a, %a
|
|
// CHECK:STDOUT: %Factory.ref: %Factory.type.1 = name_ref Factory, imports.%import_ref.1 [template = constants.%Factory.generic]
|
|
// CHECK:STDOUT: %C.ref.loc10: type = name_ref C, file.%C.decl [template = constants.%C]
|
|
// CHECK:STDOUT: %Factory.type: type = facet_type <@Factory, @Factory(constants.%C)> [template = constants.%Factory.type.4]
|
|
// CHECK:STDOUT: %.loc10: %Make.assoc_type.3 = specific_constant imports.%import_ref.7, @Factory(constants.%C) [template = constants.%assoc0.3]
|
|
// CHECK:STDOUT: %Make.ref: %Make.assoc_type.3 = name_ref Make, %.loc10 [template = constants.%assoc0.3]
|
|
// CHECK:STDOUT: return <error> to %return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Factory(constants.%T) {
|
|
// CHECK:STDOUT: %T => constants.%T
|
|
// CHECK:STDOUT: %T.patt => constants.%T
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Factory(constants.%B) {
|
|
// CHECK:STDOUT: %T => constants.%B
|
|
// CHECK:STDOUT: %T.patt => constants.%B
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !definition:
|
|
// CHECK:STDOUT: %Factory.type => constants.%Factory.type.3
|
|
// CHECK:STDOUT: %Self => constants.%Self
|
|
// CHECK:STDOUT: %Make.type => constants.%Make.type.2
|
|
// CHECK:STDOUT: %Make => constants.%Make.2
|
|
// CHECK:STDOUT: %Make.assoc_type => constants.%Make.assoc_type.2
|
|
// CHECK:STDOUT: %assoc0 => constants.%assoc0.2
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Factory(%T) {
|
|
// CHECK:STDOUT: %T => constants.%T
|
|
// CHECK:STDOUT: %T.patt => constants.%T
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Make(constants.%T, constants.%Self) {
|
|
// CHECK:STDOUT: %T => constants.%T
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: specific @Factory(constants.%C) {
|
|
// CHECK:STDOUT: %T => constants.%C
|
|
// CHECK:STDOUT: %T.patt => constants.%C
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !definition:
|
|
// CHECK:STDOUT: %Factory.type => constants.%Factory.type.4
|
|
// CHECK:STDOUT: %Self => constants.%Self
|
|
// CHECK:STDOUT: %Make.type => constants.%Make.type.3
|
|
// CHECK:STDOUT: %Make => constants.%Make.3
|
|
// CHECK:STDOUT: %Make.assoc_type => constants.%Make.assoc_type.3
|
|
// CHECK:STDOUT: %assoc0 => constants.%assoc0.3
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|