| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834 |
- // 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/assoc_const_self.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/assoc_const_self.carbon
- // --- assoc_const_self.carbon
- library "[[@TEST_NAME]]";
- interface I {
- let V:! Self;
- }
- impl {} as I where .V = {} {}
- impl i32 as I where .V = 0 {}
- // --- fail_assoc_const_mismatch.carbon
- library "[[@TEST_NAME]]";
- interface I {
- let V:! Self;
- }
- // CHECK:STDERR: fail_assoc_const_mismatch.carbon:[[@LINE+7]]:12: error: cannot implicitly convert from `Core.IntLiteral` to `{}` [ImplicitAsConversionFailure]
- // CHECK:STDERR: impl {} as I where .V = 0 {}
- // CHECK:STDERR: ^~~~~~~~~~~~~~
- // CHECK:STDERR: fail_assoc_const_mismatch.carbon:[[@LINE+4]]:12: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs({})` [MissingImplInMemberAccessNote]
- // CHECK:STDERR: impl {} as I where .V = 0 {}
- // CHECK:STDERR: ^~~~~~~~~~~~~~
- // CHECK:STDERR:
- impl {} as I where .V = 0 {}
- // --- fail_assoc_const_not_constant_after_conversion.carbon
- library "[[@TEST_NAME]]";
- interface I {
- let V:! Self;
- }
- class C {}
- impl () as Core.ImplicitAs(C) {
- fn Convert[self: ()]() -> C { return {}; }
- }
- // CHECK:STDERR: fail_assoc_const_not_constant_after_conversion.carbon:[[@LINE+4]]:11: error: associated constant V given value that is not constant after conversion to `C` [AssociatedConstantNotConstantAfterConversion]
- // CHECK:STDERR: impl C as I where .V = () {}
- // CHECK:STDERR: ^~~~~~~~~~~~~~~
- // CHECK:STDERR:
- impl C as I where .V = () {}
- // --- fail_monomorphization_failure.carbon
- library "[[@TEST_NAME]]";
- interface I(N:! Core.IntLiteral()) {
- // CHECK:STDERR: fail_monomorphization_failure.carbon:[[@LINE+3]]:12: error: array bound of -1 is negative [ArrayBoundNegative]
- // CHECK:STDERR: let V:! [Self; N];
- // CHECK:STDERR: ^~~~
- let V:! [Self; N];
- }
- // CHECK:STDERR: fail_monomorphization_failure.carbon:[[@LINE+4]]:24: note: in `V` used here [ResolvingSpecificHere]
- // CHECK:STDERR: impl {} as I(-1) where .V = () {}
- // CHECK:STDERR: ^~
- // CHECK:STDERR:
- impl {} as I(-1) where .V = () {}
- // --- fail_todo_constrained_fn.carbon
- library "[[@TEST_NAME]]";
- interface I {
- let V:! Self;
- }
- fn F(T:! I where {} impls Core.ImplicitAs(.Self) and .V = {});
- fn CallF() {
- // TODO: This call should eventually work.
- // CHECK:STDERR: fail_todo_constrained_fn.carbon:[[@LINE+10]]:3: error: cannot implicitly convert from `{}` to `I where .(I.V) = {} and...` [ImplicitAsConversionFailure]
- // CHECK:STDERR: F({});
- // CHECK:STDERR: ^~~~~
- // CHECK:STDERR: fail_todo_constrained_fn.carbon:[[@LINE+7]]:3: note: type `{}` does not implement interface `Core.ImplicitAs(I where .(I.V) = {} and...)` [MissingImplInMemberAccessNote]
- // CHECK:STDERR: F({});
- // CHECK:STDERR: ^~~~~
- // CHECK:STDERR: fail_todo_constrained_fn.carbon:[[@LINE-10]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
- // CHECK:STDERR: fn F(T:! I where {} impls Core.ImplicitAs(.Self) and .V = {});
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- F({});
- }
- // CHECK:STDOUT: --- assoc_const_self.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %I.type: type = facet_type <@I> [template]
- // CHECK:STDOUT: %Self.826: %I.type = bind_symbolic_name Self, 0 [symbolic]
- // CHECK:STDOUT: %Self.as_type.b70: type = facet_access_type %Self.826 [symbolic]
- // CHECK:STDOUT: %require_complete.9b1: <witness> = require_complete_type %Self.as_type.b70 [symbolic]
- // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [template]
- // CHECK:STDOUT: %assoc0.a1d: %I.assoc_type = assoc_entity element0, @I.%V [template]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
- // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic]
- // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic]
- // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic]
- // CHECK:STDOUT: %I.facet.1f7: %I.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic]
- // CHECK:STDOUT: %require_complete.d0c: <witness> = require_complete_type %.Self.as_type [symbolic]
- // CHECK:STDOUT: %impl.elem0: %.Self.as_type = impl_witness_access %.Self.as_wit, element0 [symbolic]
- // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [template]
- // CHECK:STDOUT: %I_where.type.5de: type = facet_type <@I where %impl.elem0 = %empty_struct> [template]
- // CHECK:STDOUT: %impl_witness.a4f: <witness> = impl_witness (%empty_struct) [template]
- // CHECK:STDOUT: %I.facet.27e: %I.type = facet_value %empty_struct_type, %impl_witness.a4f [template]
- // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
- // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
- // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
- // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [template]
- // CHECK:STDOUT: %I_where.type.cad: type = facet_type <@I where %impl.elem0 = %int_0.5c6> [template]
- // CHECK:STDOUT: %impl_witness.6f4: <witness> = impl_witness (%int_0.6a9) [template]
- // CHECK:STDOUT: %I.facet.401: %I.type = facet_value %i32, %impl_witness.6f4 [template]
- // CHECK:STDOUT: %i32.builtin: type = int_type signed, %int_32 [template]
- // CHECK:STDOUT: %complete_type.f8a: <witness> = complete_type_witness %i32.builtin [template]
- // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [template]
- // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [template]
- // CHECK:STDOUT: %impl_witness.d39: <witness> = impl_witness (imports.%Core.import_ref.a5b), @impl.2(%int_32) [template]
- // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.2(%int_32) [template]
- // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [template]
- // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, %impl_witness.d39 [template]
- // CHECK:STDOUT: %.a0b: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [template]
- // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_0.5c6, %Convert.956 [template]
- // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.2(%int_32) [template]
- // CHECK:STDOUT: %int_0.6a9: %i32 = int_value 0 [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .Int = %Core.Int
- // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/...
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .I = %I.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
- // CHECK:STDOUT: impl_decl @impl.1 [template] {} {
- // CHECK:STDOUT: %.loc8_7.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc8_7.2: type = converted %.loc8_7.1, constants.%empty_struct_type [template = constants.%empty_struct_type]
- // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
- // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
- // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
- // CHECK:STDOUT: %V.ref: %I.assoc_type = name_ref V, @V.%assoc0 [template = constants.%assoc0.a1d]
- // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type]
- // CHECK:STDOUT: %.loc8_20: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type]
- // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic = constants.%.Self.as_wit]
- // CHECK:STDOUT: %impl.elem0: %.Self.as_type = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
- // CHECK:STDOUT: %.loc8_26.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [template = constants.%empty_struct]
- // CHECK:STDOUT: %.loc8_26.2: %empty_struct_type = converted %.loc8_26.1, %empty_struct [template = constants.%empty_struct]
- // CHECK:STDOUT: %.loc8_14: type = where_expr %.Self [template = constants.%I_where.type.5de] {
- // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc8_26.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %impl_witness.loc8: <witness> = impl_witness (constants.%empty_struct) [template = constants.%impl_witness.a4f]
- // CHECK:STDOUT: impl_decl @impl.45 [template] {} {
- // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
- // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
- // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
- // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
- // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
- // CHECK:STDOUT: %V.ref: %I.assoc_type = name_ref V, @V.%assoc0 [template = constants.%assoc0.a1d]
- // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type]
- // CHECK:STDOUT: %.loc10_21: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type]
- // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic = constants.%.Self.as_wit]
- // CHECK:STDOUT: %impl.elem0: %.Self.as_type = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
- // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.5c6]
- // CHECK:STDOUT: %.loc10_15: type = where_expr %.Self [template = constants.%I_where.type.cad] {
- // CHECK:STDOUT: requirement_rewrite %impl.elem0, %int_0
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %impl_witness.loc10: <witness> = impl_witness (constants.%int_0.6a9) [template = constants.%impl_witness.6f4]
- // CHECK:STDOUT: %impl.elem0: %.a0b = impl_witness_access constants.%impl_witness.d39, element0 [template = constants.%Convert.956]
- // CHECK:STDOUT: %bound_method: <bound method> = bound_method constants.%int_0.5c6, %impl.elem0 [template = constants.%Convert.bound]
- // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %bound_method, @Convert.2(constants.%int_32) [template = constants.%Convert.specific_fn]
- // CHECK:STDOUT: %int.convert_checked: init %i32 = call %specific_fn(constants.%int_0.5c6) [template = constants.%int_0.6a9]
- // CHECK:STDOUT: %.loc10_15.1: %i32 = value_of_initializer %int.convert_checked [template = constants.%int_0.6a9]
- // CHECK:STDOUT: %.loc10_15.2: %i32 = converted constants.%int_0.5c6, %.loc10_15.1 [template = constants.%int_0.6a9]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: interface @I {
- // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.826]
- // CHECK:STDOUT: %V: @V.%Self.as_type (%Self.as_type.b70) = assoc_const_decl @V [template] {
- // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%V [template = constants.%assoc0.a1d]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = %Self
- // CHECK:STDOUT: .V = @V.%assoc0
- // CHECK:STDOUT: witness = (%V)
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic assoc_const @V(@I.%Self: %I.type) {
- // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.826)]
- // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.b70)]
- // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @V.%Self.as_type (%Self.as_type.b70) [symbolic = %require_complete (constants.%require_complete.9b1)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: assoc_const V:! @V.%Self.as_type (%Self.as_type.b70);
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: impl @impl.1: %.loc8_7.2 as %.loc8_14 {
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: witness = file.%impl_witness.loc8
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: impl @impl.45: %i32 as %.loc10_15 {
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: witness = file.%impl_witness.loc10
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @V(constants.%Self.826) {
- // CHECK:STDOUT: %Self => constants.%Self.826
- // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.b70
- // CHECK:STDOUT: %require_complete => constants.%require_complete.9b1
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @V(constants.%I.facet.1f7) {
- // CHECK:STDOUT: %Self => constants.%I.facet.1f7
- // CHECK:STDOUT: %Self.as_type => constants.%.Self.as_type
- // CHECK:STDOUT: %require_complete => constants.%require_complete.d0c
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @V(constants.%I.facet.27e) {
- // CHECK:STDOUT: %Self => constants.%I.facet.27e
- // CHECK:STDOUT: %Self.as_type => constants.%empty_struct_type
- // CHECK:STDOUT: %require_complete => constants.%complete_type.357
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @V(constants.%I.facet.401) {
- // CHECK:STDOUT: %Self => constants.%I.facet.401
- // CHECK:STDOUT: %Self.as_type => constants.%i32
- // CHECK:STDOUT: %require_complete => constants.%complete_type.f8a
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_assoc_const_mismatch.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %I.type: type = facet_type <@I> [template]
- // CHECK:STDOUT: %Self.826: %I.type = bind_symbolic_name Self, 0 [symbolic]
- // CHECK:STDOUT: %Self.as_type.b70: type = facet_access_type %Self.826 [symbolic]
- // CHECK:STDOUT: %require_complete.9b1: <witness> = require_complete_type %Self.as_type.b70 [symbolic]
- // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [template]
- // CHECK:STDOUT: %assoc0.a1d: %I.assoc_type = assoc_entity element0, @I.%V [template]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
- // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic]
- // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic]
- // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic]
- // CHECK:STDOUT: %I.facet.1f7: %I.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic]
- // CHECK:STDOUT: %require_complete.d0c: <witness> = require_complete_type %.Self.as_type [symbolic]
- // CHECK:STDOUT: %impl.elem0: %.Self.as_type = impl_witness_access %.Self.as_wit, element0 [symbolic]
- // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template]
- // CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0 = %int_0> [template]
- // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (<error>) [template]
- // CHECK:STDOUT: %I.facet.c20: %I.type = facet_value %empty_struct_type, %impl_witness [template]
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/...
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .I = %I.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
- // CHECK:STDOUT: impl_decl @impl [template] {} {
- // CHECK:STDOUT: %.loc15_7.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc15_7.2: type = converted %.loc15_7.1, constants.%empty_struct_type [template = constants.%empty_struct_type]
- // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
- // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
- // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
- // CHECK:STDOUT: %V.ref: %I.assoc_type = name_ref V, @V.%assoc0 [template = constants.%assoc0.a1d]
- // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type]
- // CHECK:STDOUT: %.loc15_20: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type]
- // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic = constants.%.Self.as_wit]
- // CHECK:STDOUT: %impl.elem0: %.Self.as_type = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
- // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0]
- // CHECK:STDOUT: %.loc15_14: type = where_expr %.Self [template = constants.%I_where.type] {
- // CHECK:STDOUT: requirement_rewrite %impl.elem0, %int_0
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (<error>) [template = constants.%impl_witness]
- // CHECK:STDOUT: %.loc15: %empty_struct_type = converted constants.%int_0, <error> [template = <error>]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: interface @I {
- // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.826]
- // CHECK:STDOUT: %V: @V.%Self.as_type (%Self.as_type.b70) = assoc_const_decl @V [template] {
- // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%V [template = constants.%assoc0.a1d]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = %Self
- // CHECK:STDOUT: .V = @V.%assoc0
- // CHECK:STDOUT: witness = (%V)
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic assoc_const @V(@I.%Self: %I.type) {
- // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.826)]
- // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.b70)]
- // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @V.%Self.as_type (%Self.as_type.b70) [symbolic = %require_complete (constants.%require_complete.9b1)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: assoc_const V:! @V.%Self.as_type (%Self.as_type.b70);
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: impl @impl: %.loc15_7.2 as %.loc15_14 {
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: witness = file.%impl_witness
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @V(constants.%Self.826) {
- // CHECK:STDOUT: %Self => constants.%Self.826
- // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.b70
- // CHECK:STDOUT: %require_complete => constants.%require_complete.9b1
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @V(constants.%I.facet.1f7) {
- // CHECK:STDOUT: %Self => constants.%I.facet.1f7
- // CHECK:STDOUT: %Self.as_type => constants.%.Self.as_type
- // CHECK:STDOUT: %require_complete => constants.%require_complete.d0c
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @V(constants.%I.facet.c20) {
- // CHECK:STDOUT: %Self => constants.%I.facet.c20
- // CHECK:STDOUT: %Self.as_type => constants.%empty_struct_type
- // CHECK:STDOUT: %require_complete => constants.%complete_type
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_assoc_const_not_constant_after_conversion.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %I.type: type = facet_type <@I> [template]
- // CHECK:STDOUT: %Self.826: %I.type = bind_symbolic_name Self, 0 [symbolic]
- // CHECK:STDOUT: %Self.as_type.b70: type = facet_access_type %Self.826 [symbolic]
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
- // CHECK:STDOUT: %require_complete.9b1: <witness> = require_complete_type %Self.as_type.b70 [symbolic]
- // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [template]
- // CHECK:STDOUT: %assoc0.a1d: %I.assoc_type = assoc_entity element0, @I.%V [template]
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
- // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [template]
- // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [template]
- // CHECK:STDOUT: %ImplicitAs.type.15e: type = facet_type <@ImplicitAs, @ImplicitAs(%C)> [template]
- // CHECK:STDOUT: %Convert.type.56d: type = fn_type @Convert.1, @ImplicitAs(%C) [template]
- // CHECK:STDOUT: %impl_witness.3db: <witness> = impl_witness (@impl.1.%Convert.decl) [template]
- // CHECK:STDOUT: %Convert.type.721: type = fn_type @Convert.2 [template]
- // CHECK:STDOUT: %Convert.155: %Convert.type.721 = struct_value () [template]
- // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.15e = facet_value %empty_tuple.type, %impl_witness.3db [template]
- // CHECK:STDOUT: %C.val: %C = struct_value () [template]
- // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic]
- // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic]
- // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic]
- // CHECK:STDOUT: %I.facet.1f7: %I.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic]
- // CHECK:STDOUT: %require_complete.d0c: <witness> = require_complete_type %.Self.as_type [symbolic]
- // CHECK:STDOUT: %impl.elem0: %.Self.as_type = impl_witness_access %.Self.as_wit, element0 [symbolic]
- // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
- // CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0 = %empty_tuple> [template]
- // CHECK:STDOUT: %impl_witness.85b: <witness> = impl_witness (<error>) [template]
- // CHECK:STDOUT: %I.facet.b45: %I.type = facet_value %C, %impl_witness.85b [template]
- // CHECK:STDOUT: %.d4d: type = fn_type_with_self_type %Convert.type.56d, %ImplicitAs.facet [template]
- // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %empty_tuple, %Convert.155 [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/...
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [template = constants.%ImplicitAs.generic]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .I = %I.decl
- // CHECK:STDOUT: .C = %C.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
- // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
- // CHECK:STDOUT: impl_decl @impl.1 [template] {} {
- // CHECK:STDOUT: %.loc10_7.1: %empty_tuple.type = tuple_literal ()
- // CHECK:STDOUT: %.loc10_7.2: type = converted %.loc10_7.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
- // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [template = imports.%Core]
- // CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.cc7 = name_ref ImplicitAs, imports.%Core.ImplicitAs [template = constants.%ImplicitAs.generic]
- // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
- // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%C)> [template = constants.%ImplicitAs.type.15e]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %impl_witness.loc10: <witness> = impl_witness (@impl.1.%Convert.decl) [template = constants.%impl_witness.3db]
- // CHECK:STDOUT: impl_decl @impl.2 [template] {} {
- // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
- // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
- // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
- // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
- // CHECK:STDOUT: %V.ref: %I.assoc_type = name_ref V, @V.%assoc0 [template = constants.%assoc0.a1d]
- // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type]
- // CHECK:STDOUT: %.loc18_19: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type]
- // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic = constants.%.Self.as_wit]
- // CHECK:STDOUT: %impl.elem0: %.Self.as_type = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
- // CHECK:STDOUT: %.loc18_25.1: %empty_tuple.type = tuple_literal ()
- // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template = constants.%empty_tuple]
- // CHECK:STDOUT: %.loc18_25.2: %empty_tuple.type = converted %.loc18_25.1, %empty_tuple [template = constants.%empty_tuple]
- // CHECK:STDOUT: %.loc18_13: type = where_expr %.Self [template = constants.%I_where.type] {
- // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc18_25.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %impl_witness.loc18: <witness> = impl_witness (<error>) [template = constants.%impl_witness.85b]
- // CHECK:STDOUT: %impl.elem0: %.d4d = impl_witness_access constants.%impl_witness.3db, element0 [template = constants.%Convert.155]
- // CHECK:STDOUT: %bound_method: <bound method> = bound_method constants.%empty_tuple, %impl.elem0 [template = constants.%Convert.bound]
- // CHECK:STDOUT: %.loc18_13.1: ref %C = temporary_storage
- // CHECK:STDOUT: %Convert.call: init %C = call %bound_method(constants.%empty_tuple) to %.loc18_13.1
- // CHECK:STDOUT: %.loc18_13.2: init %C = converted constants.%empty_tuple, %Convert.call
- // CHECK:STDOUT: %.loc18_13.3: ref %C = temporary %.loc18_13.1, %.loc18_13.2
- // CHECK:STDOUT: %.loc18_13.4: %C = bind_value %.loc18_13.3
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: interface @I {
- // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.826]
- // CHECK:STDOUT: %V: @V.%Self.as_type (%Self.as_type.b70) = assoc_const_decl @V [template] {
- // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%V [template = constants.%assoc0.a1d]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = %Self
- // CHECK:STDOUT: .V = @V.%assoc0
- // CHECK:STDOUT: witness = (%V)
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic assoc_const @V(@I.%Self: %I.type) {
- // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.826)]
- // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.b70)]
- // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @V.%Self.as_type (%Self.as_type.b70) [symbolic = %require_complete (constants.%require_complete.9b1)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: assoc_const V:! @V.%Self.as_type (%Self.as_type.b70);
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: impl @impl.1: %.loc10_7.2 as %ImplicitAs.type {
- // CHECK:STDOUT: %Convert.decl: %Convert.type.721 = fn_decl @Convert.2 [template = constants.%Convert.155] {
- // CHECK:STDOUT: %self.patt: %empty_tuple.type = binding_pattern self
- // CHECK:STDOUT: %self.param_patt: %empty_tuple.type = value_param_pattern %self.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: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
- // CHECK:STDOUT: %self.param: %empty_tuple.type = value_param runtime_param0
- // CHECK:STDOUT: %.loc11_21.1: type = splice_block %.loc11_21.3 [template = constants.%empty_tuple.type] {
- // CHECK:STDOUT: %.loc11_21.2: %empty_tuple.type = tuple_literal ()
- // CHECK:STDOUT: %.loc11_21.3: type = converted %.loc11_21.2, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %self: %empty_tuple.type = bind_name self, %self.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: !members:
- // CHECK:STDOUT: .Convert = %Convert.decl
- // CHECK:STDOUT: witness = file.%impl_witness.loc10
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: impl @impl.2: %C.ref as %.loc18_13 {
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: witness = file.%impl_witness.loc18
- // 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: complete_type_witness = %complete_type
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%C
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Convert.2[%self.param_patt: %empty_tuple.type]() -> %return.param_patt: %C {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %.loc11_41.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc11_41.2: init %C = class_init (), %return [template = constants.%C.val]
- // CHECK:STDOUT: %.loc11_42: init %C = converted %.loc11_41.1, %.loc11_41.2 [template = constants.%C.val]
- // CHECK:STDOUT: return %.loc11_42 to %return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @V(constants.%Self.826) {
- // CHECK:STDOUT: %Self => constants.%Self.826
- // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.b70
- // CHECK:STDOUT: %require_complete => constants.%require_complete.9b1
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @V(constants.%I.facet.1f7) {
- // CHECK:STDOUT: %Self => constants.%I.facet.1f7
- // CHECK:STDOUT: %Self.as_type => constants.%.Self.as_type
- // CHECK:STDOUT: %require_complete => constants.%require_complete.d0c
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @V(constants.%I.facet.b45) {
- // CHECK:STDOUT: %Self => constants.%I.facet.b45
- // CHECK:STDOUT: %Self.as_type => constants.%C
- // CHECK:STDOUT: %require_complete => constants.%complete_type
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_monomorphization_failure.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [template]
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
- // CHECK:STDOUT: %IntLiteral: %IntLiteral.type = struct_value () [template]
- // CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic]
- // CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic]
- // CHECK:STDOUT: %I.type.dac: type = generic_interface_type @I [template]
- // CHECK:STDOUT: %I.generic: %I.type.dac = struct_value () [template]
- // CHECK:STDOUT: %I.type.8a1: type = facet_type <@I, @I(%N)> [symbolic]
- // CHECK:STDOUT: %Self.3a0: %I.type.8a1 = bind_symbolic_name Self, 1 [symbolic]
- // CHECK:STDOUT: %Self.as_type.72b: type = facet_access_type %Self.3a0 [symbolic]
- // CHECK:STDOUT: %array_type: type = array_type %N, %Self.as_type.72b [symbolic]
- // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %array_type [symbolic]
- // CHECK:STDOUT: %I.assoc_type.656: type = assoc_entity_type %I.type.8a1 [symbolic]
- // CHECK:STDOUT: %assoc0.6db: %I.assoc_type.656 = assoc_entity element0, @I.%V [symbolic]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
- // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template]
- // CHECK:STDOUT: %Negate.type: type = facet_type <@Negate> [template]
- // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (imports.%Core.import_ref.c15) [template]
- // CHECK:STDOUT: %Op.type.e42: type = fn_type @Op.1 [template]
- // CHECK:STDOUT: %Negate.facet: %Negate.type = facet_value Core.IntLiteral, %impl_witness [template]
- // CHECK:STDOUT: %.45d: type = fn_type_with_self_type %Op.type.e42, %Negate.facet [template]
- // CHECK:STDOUT: %Op.type.1be: type = fn_type @Op.2 [template]
- // CHECK:STDOUT: %Op.bba: %Op.type.1be = struct_value () [template]
- // CHECK:STDOUT: %Op.bound: <bound method> = bound_method %int_1, %Op.bba [template]
- // CHECK:STDOUT: %int_-1: Core.IntLiteral = int_value -1 [template]
- // CHECK:STDOUT: %I.type.057: type = facet_type <@I, @I(%int_-1)> [template]
- // CHECK:STDOUT: %.Self: %I.type.057 = bind_symbolic_name .Self [symbolic]
- // CHECK:STDOUT: %I.assoc_type.3f5: type = assoc_entity_type %I.type.057 [template]
- // CHECK:STDOUT: %assoc0.34f: %I.assoc_type.3f5 = assoc_entity element0, @I.%V [template]
- // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic]
- // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic]
- // CHECK:STDOUT: %I.facet: %I.type.057 = facet_value %.Self.as_type, %.Self.as_wit [symbolic]
- // CHECK:STDOUT: %impl.elem0: <error> = impl_witness_access %.Self.as_wit, element0 [symbolic]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .IntLiteral = %Core.IntLiteral
- // CHECK:STDOUT: .Negate = %Core.Negate
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/...
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.IntLiteral: %IntLiteral.type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [template = constants.%IntLiteral]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .I = %I.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %I.decl: %I.type.dac = interface_decl @I [template = constants.%I.generic] {
- // CHECK:STDOUT: %N.patt.loc4_13.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc4_13.2 (constants.%N.patt)]
- // CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc4_13.1, runtime_param<none> [symbolic = %N.patt.loc4_13.2 (constants.%N.patt)]
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param<none>
- // CHECK:STDOUT: %.loc4_33.1: type = splice_block %.loc4_33.3 [template = Core.IntLiteral] {
- // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [template = imports.%Core]
- // CHECK:STDOUT: %IntLiteral.ref: %IntLiteral.type = name_ref IntLiteral, imports.%Core.IntLiteral [template = constants.%IntLiteral]
- // CHECK:STDOUT: %int_literal.make_type: init type = call %IntLiteral.ref() [template = Core.IntLiteral]
- // CHECK:STDOUT: %.loc4_33.2: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral]
- // CHECK:STDOUT: %.loc4_33.3: type = converted %int_literal.make_type, %.loc4_33.2 [template = Core.IntLiteral]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %N.loc4_13.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc4_13.2 (constants.%N)]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: impl_decl @impl.7 [template] {} {
- // CHECK:STDOUT: %.loc15_7.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc15_7.2: type = converted %.loc15_7.1, constants.%empty_struct_type [template = constants.%empty_struct_type]
- // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, file.%I.decl [template = constants.%I.generic]
- // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1]
- // CHECK:STDOUT: %impl.elem0.loc15_14: %.45d = impl_witness_access constants.%impl_witness, element0 [template = constants.%Op.bba]
- // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1, %impl.elem0.loc15_14 [template = constants.%Op.bound]
- // CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %bound_method(%int_1) [template = constants.%int_-1]
- // CHECK:STDOUT: %.loc15_16.1: Core.IntLiteral = value_of_initializer %int.snegate [template = constants.%int_-1]
- // CHECK:STDOUT: %.loc15_16.2: Core.IntLiteral = converted %int.snegate, %.loc15_16.1 [template = constants.%int_-1]
- // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%int_-1)> [template = constants.%I.type.057]
- // CHECK:STDOUT: %.Self: %I.type.057 = bind_symbolic_name .Self [symbolic = constants.%.Self]
- // CHECK:STDOUT: %.Self.ref: %I.type.057 = name_ref .Self, %.Self [symbolic = constants.%.Self]
- // CHECK:STDOUT: %.loc15_24.1: %I.assoc_type.3f5 = specific_constant @V.%assoc0, @I(constants.%int_-1) [template = constants.%assoc0.34f]
- // CHECK:STDOUT: %V.ref: %I.assoc_type.3f5 = name_ref V, %.loc15_24.1 [template = constants.%assoc0.34f]
- // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type]
- // CHECK:STDOUT: %.loc15_24.2: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type]
- // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic = constants.%.Self.as_wit]
- // CHECK:STDOUT: %impl.elem0.loc15_24: <error> = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
- // CHECK:STDOUT: %.loc15_30: %empty_tuple.type = tuple_literal ()
- // CHECK:STDOUT: %.loc15_18: type = where_expr %.Self [template = <error>] {
- // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc15_24, <error>
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic interface @I(%N.loc4_13.1: Core.IntLiteral) {
- // CHECK:STDOUT: %N.loc4_13.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc4_13.2 (constants.%N)]
- // CHECK:STDOUT: %N.patt.loc4_13.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc4_13.2 (constants.%N.patt)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%N.loc4_13.2)> [symbolic = %I.type (constants.%I.type.8a1)]
- // CHECK:STDOUT: %Self.2: %I.type.8a1 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.3a0)]
- // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I.%I.type (%I.type.8a1) [symbolic = %I.assoc_type (constants.%I.assoc_type.656)]
- // CHECK:STDOUT: %assoc0: @I.%I.assoc_type (%I.assoc_type.656) = assoc_entity element0, %V [symbolic = %assoc0 (constants.%assoc0.6db)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: interface {
- // CHECK:STDOUT: %Self.1: @I.%I.type (%I.type.8a1) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.3a0)]
- // CHECK:STDOUT: %V: @V.%array_type (%array_type) = assoc_const_decl @V [template] {
- // CHECK:STDOUT: %assoc0: @I.%I.assoc_type (%I.assoc_type.656) = assoc_entity element0, @I.%V [symbolic = @I.%assoc0 (constants.%assoc0.6db)]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = %Self.1
- // CHECK:STDOUT: .V = @V.%assoc0
- // CHECK:STDOUT: witness = (%V)
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic assoc_const @V(@I.%N.loc4_13.1: Core.IntLiteral, @I.%Self.1: @I.%I.type (%I.type.8a1)) {
- // CHECK:STDOUT: %N: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N (constants.%N)]
- // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%N)> [symbolic = %I.type (constants.%I.type.8a1)]
- // CHECK:STDOUT: %Self: %I.type.8a1 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.3a0)]
- // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.72b)]
- // CHECK:STDOUT: %array_type: type = array_type %N, @V.%Self.as_type (%Self.as_type.72b) [symbolic = %array_type (constants.%array_type)]
- // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @V.%array_type (%array_type) [symbolic = %require_complete (constants.%require_complete)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: assoc_const V:! @V.%array_type (%array_type);
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: impl @impl.7: %.loc15_7.2 as %.loc15_18 {
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: witness = <error>
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @I(constants.%N) {
- // CHECK:STDOUT: %N.loc4_13.2 => constants.%N
- // CHECK:STDOUT: %N.patt.loc4_13.2 => constants.%N
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @V(constants.%N, constants.%Self.3a0) {
- // CHECK:STDOUT: %N => constants.%N
- // CHECK:STDOUT: %I.type => constants.%I.type.8a1
- // CHECK:STDOUT: %Self => constants.%Self.3a0
- // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.72b
- // CHECK:STDOUT: %array_type => constants.%array_type
- // CHECK:STDOUT: %require_complete => constants.%require_complete
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @I(@V.%N) {}
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @I(%N.loc4_13.2) {}
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @I(constants.%int_-1) {
- // CHECK:STDOUT: %N.loc4_13.2 => constants.%int_-1
- // CHECK:STDOUT: %N.patt.loc4_13.2 => constants.%int_-1
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %I.type => constants.%I.type.057
- // CHECK:STDOUT: %Self.2 => constants.%Self.3a0
- // CHECK:STDOUT: %I.assoc_type => constants.%I.assoc_type.3f5
- // CHECK:STDOUT: %assoc0 => constants.%assoc0.34f
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @V(constants.%int_-1, constants.%I.facet) {
- // CHECK:STDOUT: %N => constants.%int_-1
- // CHECK:STDOUT: %I.type => constants.%I.type.057
- // CHECK:STDOUT: %Self => constants.%I.facet
- // CHECK:STDOUT: %Self.as_type => constants.%.Self.as_type
- // CHECK:STDOUT: %array_type => <error>
- // CHECK:STDOUT: %require_complete => <error>
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_todo_constrained_fn.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %I.type: type = facet_type <@I> [template]
- // CHECK:STDOUT: %Self.826: %I.type = bind_symbolic_name Self, 0 [symbolic]
- // CHECK:STDOUT: %Self.as_type.b70: type = facet_access_type %Self.826 [symbolic]
- // CHECK:STDOUT: %require_complete.9b1: <witness> = require_complete_type %Self.as_type.b70 [symbolic]
- // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [template]
- // CHECK:STDOUT: %assoc0.a1d: %I.assoc_type = assoc_entity element0, @I.%V [template]
- // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
- // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [template]
- // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [template]
- // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic]
- // CHECK:STDOUT: %ImplicitAs.type.2a8: type = facet_type <@ImplicitAs, @ImplicitAs(%.Self.as_type)> [symbolic]
- // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic]
- // CHECK:STDOUT: %I.facet: %I.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic]
- // CHECK:STDOUT: %require_complete.d0c: <witness> = require_complete_type %.Self.as_type [symbolic]
- // CHECK:STDOUT: %impl.elem0: %.Self.as_type = impl_witness_access %.Self.as_wit, element0 [symbolic]
- // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [template]
- // CHECK:STDOUT: %I_where.type: type = facet_type <@I where %impl.elem0 = %empty_struct and TODO> [template]
- // CHECK:STDOUT: %T: %I_where.type = bind_symbolic_name T, 0 [symbolic]
- // CHECK:STDOUT: %T.patt: %I_where.type = symbolic_binding_pattern T, 0 [symbolic]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: %CallF.type: type = fn_type @CallF [template]
- // CHECK:STDOUT: %CallF: %CallF.type = struct_value () [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/...
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [template = constants.%ImplicitAs.generic]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .I = %I.decl
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: .CallF = %CallF.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
- // CHECK:STDOUT: %T.patt.loc8_6.1: %I_where.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_6.2 (constants.%T.patt)]
- // CHECK:STDOUT: %T.param_patt: %I_where.type = value_param_pattern %T.patt.loc8_6.1, runtime_param<none> [symbolic = %T.patt.loc8_6.2 (constants.%T.patt)]
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %T.param: %I_where.type = value_param runtime_param<none>
- // CHECK:STDOUT: %.loc8_12.1: type = splice_block %.loc8_12.2 [template = constants.%I_where.type] {
- // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
- // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
- // CHECK:STDOUT: %.loc8_19.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [template = imports.%Core]
- // CHECK:STDOUT: %ImplicitAs.ref: %ImplicitAs.type.cc7 = name_ref ImplicitAs, imports.%Core.ImplicitAs [template = constants.%ImplicitAs.generic]
- // CHECK:STDOUT: %.Self.ref.loc8_43: %I.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
- // CHECK:STDOUT: %.Self.as_type.loc8_48: type = facet_access_type %.Self.ref.loc8_43 [symbolic = constants.%.Self.as_type]
- // CHECK:STDOUT: %.loc8_48: type = converted %.Self.ref.loc8_43, %.Self.as_type.loc8_48 [symbolic = constants.%.Self.as_type]
- // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%.Self.as_type)> [symbolic = constants.%ImplicitAs.type.2a8]
- // CHECK:STDOUT: %.loc8_19.2: type = converted %.loc8_19.1, constants.%empty_struct_type [template = constants.%empty_struct_type]
- // CHECK:STDOUT: %.Self.ref.loc8_54: %I.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
- // CHECK:STDOUT: %V.ref: %I.assoc_type = name_ref V, @V.%assoc0 [template = constants.%assoc0.a1d]
- // CHECK:STDOUT: %.Self.as_type.loc8_54: type = facet_access_type %.Self.ref.loc8_54 [symbolic = constants.%.Self.as_type]
- // CHECK:STDOUT: %.loc8_54: type = converted %.Self.ref.loc8_54, %.Self.as_type.loc8_54 [symbolic = constants.%.Self.as_type]
- // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref.loc8_54 [symbolic = constants.%.Self.as_wit]
- // CHECK:STDOUT: %impl.elem0: %.Self.as_type = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
- // CHECK:STDOUT: %.loc8_60.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [template = constants.%empty_struct]
- // CHECK:STDOUT: %.loc8_60.2: %empty_struct_type = converted %.loc8_60.1, %empty_struct [template = constants.%empty_struct]
- // CHECK:STDOUT: %.loc8_12.2: type = where_expr %.Self [template = constants.%I_where.type] {
- // CHECK:STDOUT: requirement_impls %.loc8_19.2, %ImplicitAs.type
- // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc8_60.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %T.loc8_6.1: %I_where.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc8_6.2 (constants.%T)]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %CallF.decl: %CallF.type = fn_decl @CallF [template = constants.%CallF] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: interface @I {
- // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.826]
- // CHECK:STDOUT: %V: @V.%Self.as_type (%Self.as_type.b70) = assoc_const_decl @V [template] {
- // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%V [template = constants.%assoc0.a1d]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = %Self
- // CHECK:STDOUT: .V = @V.%assoc0
- // CHECK:STDOUT: witness = (%V)
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic assoc_const @V(@I.%Self: %I.type) {
- // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.826)]
- // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.b70)]
- // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @V.%Self.as_type (%Self.as_type.b70) [symbolic = %require_complete (constants.%require_complete.9b1)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: assoc_const V:! @V.%Self.as_type (%Self.as_type.b70);
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @F(%T.loc8_6.1: %I_where.type) {
- // CHECK:STDOUT: %T.loc8_6.2: %I_where.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_6.2 (constants.%T)]
- // CHECK:STDOUT: %T.patt.loc8_6.2: %I_where.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_6.2 (constants.%T.patt)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn(%T.param_patt: %I_where.type);
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @CallF() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
- // CHECK:STDOUT: %.loc22_6: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc22_7: %I_where.type = converted %.loc22_6, <error> [template = <error>]
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @V(constants.%Self.826) {
- // CHECK:STDOUT: %Self => constants.%Self.826
- // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.b70
- // CHECK:STDOUT: %require_complete => constants.%require_complete.9b1
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @V(constants.%I.facet) {
- // CHECK:STDOUT: %Self => constants.%I.facet
- // CHECK:STDOUT: %Self.as_type => constants.%.Self.as_type
- // CHECK:STDOUT: %require_complete => constants.%require_complete.d0c
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F(constants.%T) {
- // CHECK:STDOUT: %T.loc8_6.2 => constants.%T
- // CHECK:STDOUT: %T.patt.loc8_6.2 => constants.%T
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
|