| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219 |
- // 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/deduce/array.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/deduce/array.carbon
- // --- type_only.carbon
- library "[[@TEST_NAME]]";
- class C {}
- fn F[T:! type](a: [T; 3]) -> T { return a[0]; }
- fn G() -> C {
- var a: [C; 3] = ({}, {}, {});
- return F(a);
- }
- // --- bound_only.carbon
- library "[[@TEST_NAME]]";
- class C {}
- fn F[N:! Core.IntLiteral()](a: [C; N]) -> i32 { return N; }
- fn G() -> i32 {
- var a: [C; 3] = ({}, {}, {});
- return F(a);
- }
- // --- type_and_bound.carbon
- library "[[@TEST_NAME]]";
- class C {}
- fn F[T:! type, N:! Core.IntLiteral()](a: [T; N]) {}
- fn G() {
- var a: [C; 3] = ({}, {}, {});
- F(a);
- }
- // --- fail_bound_mismatch.carbon
- library "[[@TEST_NAME]]";
- class C {}
- fn F[T:! type](a: [T; 2]) -> T { return a[0]; }
- fn G() -> C {
- // TODO: We succeed at deducing T here but fail to convert. Is this the right behavior?
- var a: [C; 3] = ({}, {}, {});
- // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE+10]]:12: error: cannot implicitly convert from `[C; 3]` to `[C; 2]` [ImplicitAsConversionFailure]
- // CHECK:STDERR: return F(a);
- // CHECK:STDERR: ^
- // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE+7]]:12: note: type `[C; 3]` does not implement interface `Core.ImplicitAs([C; 2])` [MissingImplInMemberAccessNote]
- // CHECK:STDERR: return F(a);
- // CHECK:STDERR: ^
- // CHECK:STDERR: fail_bound_mismatch.carbon:[[@LINE-11]]:16: note: initializing function parameter [InCallToFunctionParam]
- // CHECK:STDERR: fn F[T:! type](a: [T; 2]) -> T { return a[0]; }
- // CHECK:STDERR: ^~~~~~~~~
- // CHECK:STDERR:
- return F(a);
- }
- // --- fail_type_mismatch.carbon
- library "[[@TEST_NAME]]";
- class C {}
- class D {}
- fn F[N:! Core.IntLiteral()](a: [C; N]) -> i32 { return N; }
- fn G() -> i32 {
- // TODO: We succeed at deducing N here but fail to convert. Is this the right behavior?
- var a: [D; 3] = ({}, {}, {});
- // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+10]]:12: error: cannot implicitly convert from `[D; 3]` to `[C; 3]` [ImplicitAsConversionFailure]
- // CHECK:STDERR: return F(a);
- // CHECK:STDERR: ^
- // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+7]]:12: note: type `[D; 3]` does not implement interface `Core.ImplicitAs([C; 3])` [MissingImplInMemberAccessNote]
- // CHECK:STDERR: return F(a);
- // CHECK:STDERR: ^
- // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE-11]]:29: note: initializing function parameter [InCallToFunctionParam]
- // CHECK:STDERR: fn F[N:! Core.IntLiteral()](a: [C; N]) -> i32 { return N; }
- // CHECK:STDERR: ^~~~~~~~~
- // CHECK:STDERR:
- return F(a);
- }
- // --- fail_bound_type_mismatch.carbon
- library "[[@TEST_NAME]]";
- class C {}
- fn F[N:! i32](a: [C; N]) -> i32 { return N; }
- fn G() -> i32 {
- var a: [C; 3] = ({}, {}, {});
- // TODO: This fails because the array bound in `F` is effectively
- // `N.(ImplicitAs(IntLiteral).Convert)()`
- // which we can't deduce through. We should decide if we want to support
- // deductions of that form. If not, it'd be nice to diagnose this situation
- // better.
- // CHECK:STDERR: fail_bound_type_mismatch.carbon:[[@LINE+7]]:10: error: cannot deduce value for generic parameter `N` [DeductionIncomplete]
- // CHECK:STDERR: return F(a);
- // CHECK:STDERR: ^~~~
- // CHECK:STDERR: fail_bound_type_mismatch.carbon:[[@LINE-12]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
- // CHECK:STDERR: fn F[N:! i32](a: [C; N]) -> i32 { return N; }
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- return F(a);
- }
- // CHECK:STDOUT: --- type_only.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
- // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
- // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
- // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
- // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template]
- // CHECK:STDOUT: %array_type.743: type = array_type %int_3, %T [symbolic]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: %require_complete.4ae: <witness> = require_complete_type %T [symbolic]
- // CHECK:STDOUT: %require_complete.06f: <witness> = require_complete_type %array_type.743 [symbolic]
- // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [template]
- // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
- // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [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.1(%int_32) [template]
- // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.1(%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: %G.type: type = fn_type @G [template]
- // CHECK:STDOUT: %G: %G.type = struct_value () [template]
- // CHECK:STDOUT: %array_type.002: type = array_type %int_3, %C [template]
- // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_struct_type, %empty_struct_type, %empty_struct_type) [template]
- // CHECK:STDOUT: %C.val: %C = struct_value () [template]
- // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template]
- // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template]
- // CHECK:STDOUT: %array: %array_type.002 = tuple_value (%C.val, %C.val, %C.val) [template]
- // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F, @F(%C) [template]
- // CHECK:STDOUT: %complete_type.dd1: <witness> = complete_type_witness %array_type.002 [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: .C = %C.decl
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: .G = %G.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
- // CHECK:STDOUT: %T.patt.loc6_6.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
- // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc6_6.1, runtime_param<none> [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
- // CHECK:STDOUT: %a.patt: @F.%array_type.loc6_24.2 (%array_type.743) = binding_pattern a
- // CHECK:STDOUT: %a.param_patt: @F.%array_type.loc6_24.2 (%array_type.743) = value_param_pattern %a.patt, runtime_param0
- // CHECK:STDOUT: %return.patt: @F.%T.loc6_6.2 (%T) = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: @F.%T.loc6_6.2 (%T) = out_param_pattern %return.patt, runtime_param1
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %T.ref.loc6_30: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)]
- // CHECK:STDOUT: %T.param: type = value_param runtime_param<none>
- // CHECK:STDOUT: %T.loc6_6.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc6_6.2 (constants.%T)]
- // CHECK:STDOUT: %a.param: @F.%array_type.loc6_24.2 (%array_type.743) = value_param runtime_param0
- // CHECK:STDOUT: %.loc6_24: type = splice_block %array_type.loc6_24.1 [symbolic = %array_type.loc6_24.2 (constants.%array_type.743)] {
- // CHECK:STDOUT: %T.ref.loc6_20: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)]
- // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template = constants.%int_3]
- // CHECK:STDOUT: %array_type.loc6_24.1: type = array_type %int_3, %T [symbolic = %array_type.loc6_24.2 (constants.%array_type.743)]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: @F.%array_type.loc6_24.2 (%array_type.743) = bind_name a, %a.param
- // CHECK:STDOUT: %return.param: ref @F.%T.loc6_6.2 (%T) = out_param runtime_param1
- // CHECK:STDOUT: %return: ref @F.%T.loc6_6.2 (%T) = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
- // CHECK:STDOUT: %return.patt: %C = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param0
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, file.%C.decl [template = constants.%C]
- // CHECK:STDOUT: %return.param: ref %C = out_param runtime_param0
- // CHECK:STDOUT: %return: ref %C = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C {
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
- // CHECK:STDOUT: complete_type_witness = %complete_type
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%C
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @F(%T.loc6_6.1: type) {
- // CHECK:STDOUT: %T.loc6_6.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_6.2 (constants.%T)]
- // CHECK:STDOUT: %T.patt.loc6_6.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
- // CHECK:STDOUT: %array_type.loc6_24.2: type = array_type constants.%int_3, @F.%T.loc6_6.2 (%T) [symbolic = %array_type.loc6_24.2 (constants.%array_type.743)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %require_complete.loc6_27: <witness> = require_complete_type @F.%T.loc6_6.2 (%T) [symbolic = %require_complete.loc6_27 (constants.%require_complete.4ae)]
- // CHECK:STDOUT: %require_complete.loc6_17: <witness> = require_complete_type @F.%array_type.loc6_24.2 (%array_type.743) [symbolic = %require_complete.loc6_17 (constants.%require_complete.06f)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn[%T.param_patt: type](%a.param_patt: @F.%array_type.loc6_24.2 (%array_type.743)) -> @F.%T.loc6_6.2 (%T) {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %a.ref: @F.%array_type.loc6_24.2 (%array_type.743) = name_ref a, %a
- // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.5c6]
- // 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: %impl.elem0: %.a0b = impl_witness_access constants.%impl_witness.d39, element0 [template = constants.%Convert.956]
- // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_0, %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(%int_0) [template = constants.%int_0.6a9]
- // CHECK:STDOUT: %.loc6_43.1: %i32 = value_of_initializer %int.convert_checked [template = constants.%int_0.6a9]
- // CHECK:STDOUT: %.loc6_43.2: %i32 = converted %int_0, %.loc6_43.1 [template = constants.%int_0.6a9]
- // CHECK:STDOUT: %.loc6_44.1: ref @F.%array_type.loc6_24.2 (%array_type.743) = value_as_ref %a.ref
- // CHECK:STDOUT: %.loc6_44.2: ref @F.%T.loc6_6.2 (%T) = array_index %.loc6_44.1, %.loc6_43.2
- // CHECK:STDOUT: %.loc6_44.3: @F.%T.loc6_6.2 (%T) = bind_value %.loc6_44.2
- // CHECK:STDOUT: return %.loc6_44.3
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G() -> %return.param_patt: %C {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %a.patt: %array_type.002 = binding_pattern a
- // CHECK:STDOUT: %.loc9_3.1: %array_type.002 = var_pattern %a.patt
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a.var: ref %array_type.002 = var a
- // CHECK:STDOUT: %.loc9_21.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc9_25.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc9_29.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc9_30.1: %tuple.type = tuple_literal (%.loc9_21.1, %.loc9_25.1, %.loc9_29.1)
- // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.5c6]
- // CHECK:STDOUT: %.loc9_30.2: ref %C = array_index %a.var, %int_0
- // CHECK:STDOUT: %.loc9_21.2: init %C = class_init (), %.loc9_30.2 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc9_30.3: init %C = converted %.loc9_21.1, %.loc9_21.2 [template = constants.%C.val]
- // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1]
- // CHECK:STDOUT: %.loc9_30.4: ref %C = array_index %a.var, %int_1
- // CHECK:STDOUT: %.loc9_25.2: init %C = class_init (), %.loc9_30.4 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc9_30.5: init %C = converted %.loc9_25.1, %.loc9_25.2 [template = constants.%C.val]
- // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2]
- // CHECK:STDOUT: %.loc9_30.6: ref %C = array_index %a.var, %int_2
- // CHECK:STDOUT: %.loc9_29.2: init %C = class_init (), %.loc9_30.6 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc9_30.7: init %C = converted %.loc9_29.1, %.loc9_29.2 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc9_30.8: init %array_type.002 = array_init (%.loc9_30.3, %.loc9_30.5, %.loc9_30.7) to %a.var [template = constants.%array]
- // CHECK:STDOUT: %.loc9_3.2: init %array_type.002 = converted %.loc9_30.1, %.loc9_30.8 [template = constants.%array]
- // CHECK:STDOUT: assign %a.var, %.loc9_3.2
- // CHECK:STDOUT: %.loc9_15: type = splice_block %array_type [template = constants.%array_type.002] {
- // CHECK:STDOUT: %C.ref.loc9: type = name_ref C, file.%C.decl [template = constants.%C]
- // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template = constants.%int_3]
- // CHECK:STDOUT: %array_type: type = array_type %int_3, %C [template = constants.%array_type.002]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: ref %array_type.002 = bind_name a, %a.var
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
- // CHECK:STDOUT: %a.ref: ref %array_type.002 = name_ref a, %a
- // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F.ref, @F(constants.%C) [template = constants.%F.specific_fn]
- // CHECK:STDOUT: %.loc8: ref %C = splice_block %return {}
- // CHECK:STDOUT: %.loc10: %array_type.002 = bind_value %a.ref
- // CHECK:STDOUT: %F.call: init %C = call %F.specific_fn(%.loc10) to %.loc8
- // CHECK:STDOUT: return %F.call to %return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F(constants.%T) {
- // CHECK:STDOUT: %T.loc6_6.2 => constants.%T
- // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%T
- // CHECK:STDOUT: %array_type.loc6_24.2 => constants.%array_type.743
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F(constants.%C) {
- // CHECK:STDOUT: %T.loc6_6.2 => constants.%C
- // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%C
- // CHECK:STDOUT: %array_type.loc6_24.2 => constants.%array_type.002
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %require_complete.loc6_27 => constants.%complete_type.357
- // CHECK:STDOUT: %require_complete.loc6_17 => constants.%complete_type.dd1
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- bound_only.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
- // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
- // CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [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: %array_type.6a2: type = array_type %N, %C [symbolic]
- // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
- // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: %require_complete.d82: <witness> = require_complete_type %array_type.6a2 [symbolic]
- // 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.1(%int_32) [template]
- // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.1(%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.41f: <bound method> = bound_method %N, %Convert.956 [symbolic]
- // CHECK:STDOUT: %Convert.specific_fn.122: <specific function> = specific_function %Convert.bound.41f, @Convert.2(%int_32) [symbolic]
- // CHECK:STDOUT: %int.convert_checked: init %i32 = call %Convert.specific_fn.122(%N) [symbolic]
- // CHECK:STDOUT: %G.type: type = fn_type @G [template]
- // CHECK:STDOUT: %G: %G.type = struct_value () [template]
- // CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [template]
- // CHECK:STDOUT: %array_type.002: type = array_type %int_3.1ba, %C [template]
- // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_struct_type, %empty_struct_type, %empty_struct_type) [template]
- // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template]
- // CHECK:STDOUT: %C.val: %C = struct_value () [template]
- // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template]
- // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template]
- // CHECK:STDOUT: %array: %array_type.002 = tuple_value (%C.val, %C.val, %C.val) [template]
- // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F, @F(%int_3.1ba) [template]
- // CHECK:STDOUT: %complete_type.dd1: <witness> = complete_type_witness %array_type.002 [template]
- // CHECK:STDOUT: %Convert.bound.b30: <bound method> = bound_method %int_3.1ba, %Convert.956 [template]
- // CHECK:STDOUT: %Convert.specific_fn.b42: <specific function> = specific_function %Convert.bound.b30, @Convert.2(%int_32) [template]
- // CHECK:STDOUT: %int_3.822: %i32 = int_value 3 [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .IntLiteral = %Core.IntLiteral
- // CHECK:STDOUT: .Int = %Core.Int
- // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/...
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.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: .C = %C.decl
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: .G = %G.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
- // CHECK:STDOUT: %N.patt.loc6_6.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_6.2 (constants.%N.patt)]
- // CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc6_6.1, runtime_param<none> [symbolic = %N.patt.loc6_6.2 (constants.%N.patt)]
- // CHECK:STDOUT: %a.patt: @F.%array_type.loc6_37.2 (%array_type.6a2) = binding_pattern a
- // CHECK:STDOUT: %a.param_patt: @F.%array_type.loc6_37.2 (%array_type.6a2) = value_param_pattern %a.patt, runtime_param0
- // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1
- // CHECK:STDOUT: } {
- // 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: %N.param: Core.IntLiteral = value_param runtime_param<none>
- // CHECK:STDOUT: %.loc6_26.1: type = splice_block %.loc6_26.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: %.loc6_26.2: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral]
- // CHECK:STDOUT: %.loc6_26.3: type = converted %int_literal.make_type, %.loc6_26.2 [template = Core.IntLiteral]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %N.loc6_6.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_6.2 (constants.%N)]
- // CHECK:STDOUT: %a.param: @F.%array_type.loc6_37.2 (%array_type.6a2) = value_param runtime_param0
- // CHECK:STDOUT: %.loc6_37: type = splice_block %array_type.loc6_37.1 [symbolic = %array_type.loc6_37.2 (constants.%array_type.6a2)] {
- // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
- // CHECK:STDOUT: %N.ref.loc6_36: Core.IntLiteral = name_ref N, %N.loc6_6.1 [symbolic = %N.loc6_6.2 (constants.%N)]
- // CHECK:STDOUT: %array_type.loc6_37.1: type = array_type %N.ref.loc6_36, %C [symbolic = %array_type.loc6_37.2 (constants.%array_type.6a2)]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: @F.%array_type.loc6_37.2 (%array_type.6a2) = bind_name a, %a.param
- // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1
- // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
- // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param0
- // CHECK:STDOUT: } {
- // 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: %return.param: ref %i32 = out_param runtime_param0
- // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C {
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
- // CHECK:STDOUT: complete_type_witness = %complete_type
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%C
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @F(%N.loc6_6.1: Core.IntLiteral) {
- // CHECK:STDOUT: %N.loc6_6.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc6_6.2 (constants.%N)]
- // CHECK:STDOUT: %N.patt.loc6_6.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_6.2 (constants.%N.patt)]
- // CHECK:STDOUT: %array_type.loc6_37.2: type = array_type %N.loc6_6.2, %C [symbolic = %array_type.loc6_37.2 (constants.%array_type.6a2)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @F.%array_type.loc6_37.2 (%array_type.6a2) [symbolic = %require_complete (constants.%require_complete.d82)]
- // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %N.loc6_6.2, constants.%Convert.956 [symbolic = %Convert.bound (constants.%Convert.bound.41f)]
- // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.2(constants.%int_32) [symbolic = %Convert.specific_fn (constants.%Convert.specific_fn.122)]
- // CHECK:STDOUT: %int.convert_checked.loc6_57.2: init %i32 = call %Convert.specific_fn(%N.loc6_6.2) [symbolic = %int.convert_checked.loc6_57.2 (constants.%int.convert_checked)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn[%N.param_patt: Core.IntLiteral](%a.param_patt: @F.%array_type.loc6_37.2 (%array_type.6a2)) -> %i32 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %N.ref.loc6_56: Core.IntLiteral = name_ref N, %N.loc6_6.1 [symbolic = %N.loc6_6.2 (constants.%N)]
- // 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 %N.ref.loc6_56, %impl.elem0 [symbolic = %Convert.bound (constants.%Convert.bound.41f)]
- // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %bound_method, @Convert.2(constants.%int_32) [symbolic = %Convert.specific_fn (constants.%Convert.specific_fn.122)]
- // CHECK:STDOUT: %int.convert_checked.loc6_57.1: init %i32 = call %specific_fn(%N.ref.loc6_56) [symbolic = %int.convert_checked.loc6_57.2 (constants.%int.convert_checked)]
- // CHECK:STDOUT: %.loc6_57.1: %i32 = value_of_initializer %int.convert_checked.loc6_57.1 [symbolic = %int.convert_checked.loc6_57.2 (constants.%int.convert_checked)]
- // CHECK:STDOUT: %.loc6_57.2: %i32 = converted %N.ref.loc6_56, %.loc6_57.1 [symbolic = %int.convert_checked.loc6_57.2 (constants.%int.convert_checked)]
- // CHECK:STDOUT: return %.loc6_57.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G() -> %i32 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %a.patt: %array_type.002 = binding_pattern a
- // CHECK:STDOUT: %.loc9_3.1: %array_type.002 = var_pattern %a.patt
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a.var: ref %array_type.002 = var a
- // CHECK:STDOUT: %.loc9_21.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc9_25.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc9_29.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc9_30.1: %tuple.type = tuple_literal (%.loc9_21.1, %.loc9_25.1, %.loc9_29.1)
- // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0]
- // CHECK:STDOUT: %.loc9_30.2: ref %C = array_index %a.var, %int_0
- // CHECK:STDOUT: %.loc9_21.2: init %C = class_init (), %.loc9_30.2 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc9_30.3: init %C = converted %.loc9_21.1, %.loc9_21.2 [template = constants.%C.val]
- // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1]
- // CHECK:STDOUT: %.loc9_30.4: ref %C = array_index %a.var, %int_1
- // CHECK:STDOUT: %.loc9_25.2: init %C = class_init (), %.loc9_30.4 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc9_30.5: init %C = converted %.loc9_25.1, %.loc9_25.2 [template = constants.%C.val]
- // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2]
- // CHECK:STDOUT: %.loc9_30.6: ref %C = array_index %a.var, %int_2
- // CHECK:STDOUT: %.loc9_29.2: init %C = class_init (), %.loc9_30.6 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc9_30.7: init %C = converted %.loc9_29.1, %.loc9_29.2 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc9_30.8: init %array_type.002 = array_init (%.loc9_30.3, %.loc9_30.5, %.loc9_30.7) to %a.var [template = constants.%array]
- // CHECK:STDOUT: %.loc9_3.2: init %array_type.002 = converted %.loc9_30.1, %.loc9_30.8 [template = constants.%array]
- // CHECK:STDOUT: assign %a.var, %.loc9_3.2
- // CHECK:STDOUT: %.loc9_15: type = splice_block %array_type [template = constants.%array_type.002] {
- // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
- // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template = constants.%int_3.1ba]
- // CHECK:STDOUT: %array_type: type = array_type %int_3, %C [template = constants.%array_type.002]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: ref %array_type.002 = bind_name a, %a.var
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
- // CHECK:STDOUT: %a.ref: ref %array_type.002 = name_ref a, %a
- // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F.ref, @F(constants.%int_3.1ba) [template = constants.%F.specific_fn]
- // CHECK:STDOUT: %.loc10_12: %array_type.002 = bind_value %a.ref
- // CHECK:STDOUT: %F.call: init %i32 = call %F.specific_fn(%.loc10_12)
- // CHECK:STDOUT: %.loc10_14.1: %i32 = value_of_initializer %F.call
- // CHECK:STDOUT: %.loc10_14.2: %i32 = converted %F.call, %.loc10_14.1
- // CHECK:STDOUT: return %.loc10_14.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F(constants.%N) {
- // CHECK:STDOUT: %N.loc6_6.2 => constants.%N
- // CHECK:STDOUT: %N.patt.loc6_6.2 => constants.%N
- // CHECK:STDOUT: %array_type.loc6_37.2 => constants.%array_type.6a2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F(constants.%int_3.1ba) {
- // CHECK:STDOUT: %N.loc6_6.2 => constants.%int_3.1ba
- // CHECK:STDOUT: %N.patt.loc6_6.2 => constants.%int_3.1ba
- // CHECK:STDOUT: %array_type.loc6_37.2 => constants.%array_type.002
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %require_complete => constants.%complete_type.dd1
- // CHECK:STDOUT: %Convert.bound => constants.%Convert.bound.b30
- // CHECK:STDOUT: %Convert.specific_fn => constants.%Convert.specific_fn.b42
- // CHECK:STDOUT: %int.convert_checked.loc6_57.2 => constants.%int_3.822
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- type_and_bound.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
- // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
- // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
- // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
- // 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, 1 [symbolic]
- // CHECK:STDOUT: %N.patt: Core.IntLiteral = symbolic_binding_pattern N, 1 [symbolic]
- // CHECK:STDOUT: %array_type.bb5: type = array_type %N, %T [symbolic]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %array_type.bb5 [symbolic]
- // CHECK:STDOUT: %G.type: type = fn_type @G [template]
- // CHECK:STDOUT: %G: %G.type = struct_value () [template]
- // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template]
- // CHECK:STDOUT: %array_type.002: type = array_type %int_3, %C [template]
- // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_struct_type, %empty_struct_type, %empty_struct_type) [template]
- // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template]
- // CHECK:STDOUT: %C.val: %C = struct_value () [template]
- // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template]
- // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template]
- // CHECK:STDOUT: %array: %array_type.002 = tuple_value (%C.val, %C.val, %C.val) [template]
- // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F, @F(%C, %int_3) [template]
- // CHECK:STDOUT: %complete_type.dd1: <witness> = complete_type_witness %array_type.002 [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .IntLiteral = %Core.IntLiteral
- // 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: .C = %C.decl
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: .G = %G.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
- // CHECK:STDOUT: %T.patt.loc6_6.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
- // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc6_6.1, runtime_param<none> [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
- // CHECK:STDOUT: %N.patt.loc6_16.1: Core.IntLiteral = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc6_16.2 (constants.%N.patt)]
- // CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc6_16.1, runtime_param<none> [symbolic = %N.patt.loc6_16.2 (constants.%N.patt)]
- // CHECK:STDOUT: %a.patt: @F.%array_type.loc6_47.2 (%array_type.bb5) = binding_pattern a
- // CHECK:STDOUT: %a.param_patt: @F.%array_type.loc6_47.2 (%array_type.bb5) = value_param_pattern %a.patt, runtime_param0
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %T.param: type = value_param runtime_param<none>
- // CHECK:STDOUT: %T.loc6_6.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc6_6.2 (constants.%T)]
- // CHECK:STDOUT: %N.param: Core.IntLiteral = value_param runtime_param<none>
- // CHECK:STDOUT: %.loc6_36.1: type = splice_block %.loc6_36.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: %.loc6_36.2: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral]
- // CHECK:STDOUT: %.loc6_36.3: type = converted %int_literal.make_type, %.loc6_36.2 [template = Core.IntLiteral]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %N.loc6_16.1: Core.IntLiteral = bind_symbolic_name N, 1, %N.param [symbolic = %N.loc6_16.2 (constants.%N)]
- // CHECK:STDOUT: %a.param: @F.%array_type.loc6_47.2 (%array_type.bb5) = value_param runtime_param0
- // CHECK:STDOUT: %.loc6_47: type = splice_block %array_type.loc6_47.1 [symbolic = %array_type.loc6_47.2 (constants.%array_type.bb5)] {
- // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)]
- // CHECK:STDOUT: %N.ref: Core.IntLiteral = name_ref N, %N.loc6_16.1 [symbolic = %N.loc6_16.2 (constants.%N)]
- // CHECK:STDOUT: %array_type.loc6_47.1: type = array_type %N.ref, %T [symbolic = %array_type.loc6_47.2 (constants.%array_type.bb5)]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: @F.%array_type.loc6_47.2 (%array_type.bb5) = bind_name a, %a.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C {
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
- // CHECK:STDOUT: complete_type_witness = %complete_type
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%C
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @F(%T.loc6_6.1: type, %N.loc6_16.1: Core.IntLiteral) {
- // CHECK:STDOUT: %T.loc6_6.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_6.2 (constants.%T)]
- // CHECK:STDOUT: %T.patt.loc6_6.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
- // CHECK:STDOUT: %N.loc6_16.2: Core.IntLiteral = bind_symbolic_name N, 1 [symbolic = %N.loc6_16.2 (constants.%N)]
- // CHECK:STDOUT: %N.patt.loc6_16.2: Core.IntLiteral = symbolic_binding_pattern N, 1 [symbolic = %N.patt.loc6_16.2 (constants.%N.patt)]
- // CHECK:STDOUT: %array_type.loc6_47.2: type = array_type %N.loc6_16.2, @F.%T.loc6_6.2 (%T) [symbolic = %array_type.loc6_47.2 (constants.%array_type.bb5)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @F.%array_type.loc6_47.2 (%array_type.bb5) [symbolic = %require_complete (constants.%require_complete)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn[%T.param_patt: type, %N.param_patt: Core.IntLiteral](%a.param_patt: @F.%array_type.loc6_47.2 (%array_type.bb5)) {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %a.patt: %array_type.002 = binding_pattern a
- // CHECK:STDOUT: %.loc9_3.1: %array_type.002 = var_pattern %a.patt
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a.var: ref %array_type.002 = var a
- // CHECK:STDOUT: %.loc9_21.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc9_25.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc9_29.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc9_30.1: %tuple.type = tuple_literal (%.loc9_21.1, %.loc9_25.1, %.loc9_29.1)
- // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0]
- // CHECK:STDOUT: %.loc9_30.2: ref %C = array_index %a.var, %int_0
- // CHECK:STDOUT: %.loc9_21.2: init %C = class_init (), %.loc9_30.2 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc9_30.3: init %C = converted %.loc9_21.1, %.loc9_21.2 [template = constants.%C.val]
- // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1]
- // CHECK:STDOUT: %.loc9_30.4: ref %C = array_index %a.var, %int_1
- // CHECK:STDOUT: %.loc9_25.2: init %C = class_init (), %.loc9_30.4 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc9_30.5: init %C = converted %.loc9_25.1, %.loc9_25.2 [template = constants.%C.val]
- // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2]
- // CHECK:STDOUT: %.loc9_30.6: ref %C = array_index %a.var, %int_2
- // CHECK:STDOUT: %.loc9_29.2: init %C = class_init (), %.loc9_30.6 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc9_30.7: init %C = converted %.loc9_29.1, %.loc9_29.2 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc9_30.8: init %array_type.002 = array_init (%.loc9_30.3, %.loc9_30.5, %.loc9_30.7) to %a.var [template = constants.%array]
- // CHECK:STDOUT: %.loc9_3.2: init %array_type.002 = converted %.loc9_30.1, %.loc9_30.8 [template = constants.%array]
- // CHECK:STDOUT: assign %a.var, %.loc9_3.2
- // CHECK:STDOUT: %.loc9_15: type = splice_block %array_type [template = constants.%array_type.002] {
- // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
- // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template = constants.%int_3]
- // CHECK:STDOUT: %array_type: type = array_type %int_3, %C [template = constants.%array_type.002]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: ref %array_type.002 = bind_name a, %a.var
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
- // CHECK:STDOUT: %a.ref: ref %array_type.002 = name_ref a, %a
- // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F.ref, @F(constants.%C, constants.%int_3) [template = constants.%F.specific_fn]
- // CHECK:STDOUT: %.loc10: %array_type.002 = bind_value %a.ref
- // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn(%.loc10)
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F(constants.%T, constants.%N) {
- // CHECK:STDOUT: %T.loc6_6.2 => constants.%T
- // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%T
- // CHECK:STDOUT: %N.loc6_16.2 => constants.%N
- // CHECK:STDOUT: %N.patt.loc6_16.2 => constants.%N
- // CHECK:STDOUT: %array_type.loc6_47.2 => constants.%array_type.bb5
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F(constants.%C, constants.%int_3) {
- // CHECK:STDOUT: %T.loc6_6.2 => constants.%C
- // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%C
- // CHECK:STDOUT: %N.loc6_16.2 => constants.%int_3
- // CHECK:STDOUT: %N.patt.loc6_16.2 => constants.%int_3
- // CHECK:STDOUT: %array_type.loc6_47.2 => constants.%array_type.002
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %require_complete => constants.%complete_type.dd1
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_bound_mismatch.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
- // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
- // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
- // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
- // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template]
- // CHECK:STDOUT: %array_type.9d4: type = array_type %int_2, %T [symbolic]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: %require_complete.4ae: <witness> = require_complete_type %T [symbolic]
- // CHECK:STDOUT: %require_complete.d11: <witness> = require_complete_type %array_type.9d4 [symbolic]
- // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [template]
- // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
- // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [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.1(%int_32) [template]
- // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.1(%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: %G.type: type = fn_type @G [template]
- // CHECK:STDOUT: %G: %G.type = struct_value () [template]
- // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template]
- // CHECK:STDOUT: %array_type.002: type = array_type %int_3, %C [template]
- // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_struct_type, %empty_struct_type, %empty_struct_type) [template]
- // CHECK:STDOUT: %C.val: %C = struct_value () [template]
- // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template]
- // CHECK:STDOUT: %array: %array_type.002 = tuple_value (%C.val, %C.val, %C.val) [template]
- // CHECK:STDOUT: %array_type.15a: type = array_type %int_2, %C [template]
- // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F, @F(%C) [template]
- // CHECK:STDOUT: %complete_type.8eb: <witness> = complete_type_witness %array_type.15a [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: .C = %C.decl
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: .G = %G.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
- // CHECK:STDOUT: %T.patt.loc6_6.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
- // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc6_6.1, runtime_param<none> [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
- // CHECK:STDOUT: %a.patt: @F.%array_type.loc6_24.2 (%array_type.9d4) = binding_pattern a
- // CHECK:STDOUT: %a.param_patt: @F.%array_type.loc6_24.2 (%array_type.9d4) = value_param_pattern %a.patt, runtime_param0
- // CHECK:STDOUT: %return.patt: @F.%T.loc6_6.2 (%T) = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: @F.%T.loc6_6.2 (%T) = out_param_pattern %return.patt, runtime_param1
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %T.ref.loc6_30: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)]
- // CHECK:STDOUT: %T.param: type = value_param runtime_param<none>
- // CHECK:STDOUT: %T.loc6_6.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc6_6.2 (constants.%T)]
- // CHECK:STDOUT: %a.param: @F.%array_type.loc6_24.2 (%array_type.9d4) = value_param runtime_param0
- // CHECK:STDOUT: %.loc6_24: type = splice_block %array_type.loc6_24.1 [symbolic = %array_type.loc6_24.2 (constants.%array_type.9d4)] {
- // CHECK:STDOUT: %T.ref.loc6_20: type = name_ref T, %T.loc6_6.1 [symbolic = %T.loc6_6.2 (constants.%T)]
- // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2]
- // CHECK:STDOUT: %array_type.loc6_24.1: type = array_type %int_2, %T [symbolic = %array_type.loc6_24.2 (constants.%array_type.9d4)]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: @F.%array_type.loc6_24.2 (%array_type.9d4) = bind_name a, %a.param
- // CHECK:STDOUT: %return.param: ref @F.%T.loc6_6.2 (%T) = out_param runtime_param1
- // CHECK:STDOUT: %return: ref @F.%T.loc6_6.2 (%T) = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
- // CHECK:STDOUT: %return.patt: %C = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param0
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, file.%C.decl [template = constants.%C]
- // CHECK:STDOUT: %return.param: ref %C = out_param runtime_param0
- // CHECK:STDOUT: %return: ref %C = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C {
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
- // CHECK:STDOUT: complete_type_witness = %complete_type
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%C
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @F(%T.loc6_6.1: type) {
- // CHECK:STDOUT: %T.loc6_6.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_6.2 (constants.%T)]
- // CHECK:STDOUT: %T.patt.loc6_6.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_6.2 (constants.%T.patt)]
- // CHECK:STDOUT: %array_type.loc6_24.2: type = array_type constants.%int_2, @F.%T.loc6_6.2 (%T) [symbolic = %array_type.loc6_24.2 (constants.%array_type.9d4)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %require_complete.loc6_27: <witness> = require_complete_type @F.%T.loc6_6.2 (%T) [symbolic = %require_complete.loc6_27 (constants.%require_complete.4ae)]
- // CHECK:STDOUT: %require_complete.loc6_17: <witness> = require_complete_type @F.%array_type.loc6_24.2 (%array_type.9d4) [symbolic = %require_complete.loc6_17 (constants.%require_complete.d11)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn[%T.param_patt: type](%a.param_patt: @F.%array_type.loc6_24.2 (%array_type.9d4)) -> @F.%T.loc6_6.2 (%T) {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %a.ref: @F.%array_type.loc6_24.2 (%array_type.9d4) = name_ref a, %a
- // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.5c6]
- // 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: %impl.elem0: %.a0b = impl_witness_access constants.%impl_witness.d39, element0 [template = constants.%Convert.956]
- // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_0, %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(%int_0) [template = constants.%int_0.6a9]
- // CHECK:STDOUT: %.loc6_43.1: %i32 = value_of_initializer %int.convert_checked [template = constants.%int_0.6a9]
- // CHECK:STDOUT: %.loc6_43.2: %i32 = converted %int_0, %.loc6_43.1 [template = constants.%int_0.6a9]
- // CHECK:STDOUT: %.loc6_44.1: ref @F.%array_type.loc6_24.2 (%array_type.9d4) = value_as_ref %a.ref
- // CHECK:STDOUT: %.loc6_44.2: ref @F.%T.loc6_6.2 (%T) = array_index %.loc6_44.1, %.loc6_43.2
- // CHECK:STDOUT: %.loc6_44.3: @F.%T.loc6_6.2 (%T) = bind_value %.loc6_44.2
- // CHECK:STDOUT: return %.loc6_44.3
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G() -> %return.param_patt: %C {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %a.patt: %array_type.002 = binding_pattern a
- // CHECK:STDOUT: %.loc10_3.1: %array_type.002 = var_pattern %a.patt
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a.var: ref %array_type.002 = var a
- // CHECK:STDOUT: %.loc10_21.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc10_25.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc10_29.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc10_30.1: %tuple.type = tuple_literal (%.loc10_21.1, %.loc10_25.1, %.loc10_29.1)
- // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0.5c6]
- // CHECK:STDOUT: %.loc10_30.2: ref %C = array_index %a.var, %int_0
- // CHECK:STDOUT: %.loc10_21.2: init %C = class_init (), %.loc10_30.2 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc10_30.3: init %C = converted %.loc10_21.1, %.loc10_21.2 [template = constants.%C.val]
- // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1]
- // CHECK:STDOUT: %.loc10_30.4: ref %C = array_index %a.var, %int_1
- // CHECK:STDOUT: %.loc10_25.2: init %C = class_init (), %.loc10_30.4 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc10_30.5: init %C = converted %.loc10_25.1, %.loc10_25.2 [template = constants.%C.val]
- // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2]
- // CHECK:STDOUT: %.loc10_30.6: ref %C = array_index %a.var, %int_2
- // CHECK:STDOUT: %.loc10_29.2: init %C = class_init (), %.loc10_30.6 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc10_30.7: init %C = converted %.loc10_29.1, %.loc10_29.2 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc10_30.8: init %array_type.002 = array_init (%.loc10_30.3, %.loc10_30.5, %.loc10_30.7) to %a.var [template = constants.%array]
- // CHECK:STDOUT: %.loc10_3.2: init %array_type.002 = converted %.loc10_30.1, %.loc10_30.8 [template = constants.%array]
- // CHECK:STDOUT: assign %a.var, %.loc10_3.2
- // CHECK:STDOUT: %.loc10_15: type = splice_block %array_type [template = constants.%array_type.002] {
- // CHECK:STDOUT: %C.ref.loc10: type = name_ref C, file.%C.decl [template = constants.%C]
- // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template = constants.%int_3]
- // CHECK:STDOUT: %array_type: type = array_type %int_3, %C [template = constants.%array_type.002]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: ref %array_type.002 = bind_name a, %a.var
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
- // CHECK:STDOUT: %a.ref: ref %array_type.002 = name_ref a, %a
- // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F.ref, @F(constants.%C) [template = constants.%F.specific_fn]
- // CHECK:STDOUT: %.loc8: ref %C = splice_block %return {}
- // CHECK:STDOUT: %.loc21: %array_type.15a = converted %a.ref, <error> [template = <error>]
- // CHECK:STDOUT: %F.call: init %C = call %F.specific_fn(<error>) to %.loc8
- // CHECK:STDOUT: return %F.call to %return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F(constants.%T) {
- // CHECK:STDOUT: %T.loc6_6.2 => constants.%T
- // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%T
- // CHECK:STDOUT: %array_type.loc6_24.2 => constants.%array_type.9d4
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F(constants.%C) {
- // CHECK:STDOUT: %T.loc6_6.2 => constants.%C
- // CHECK:STDOUT: %T.patt.loc6_6.2 => constants.%C
- // CHECK:STDOUT: %array_type.loc6_24.2 => constants.%array_type.15a
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %require_complete.loc6_27 => constants.%complete_type.357
- // CHECK:STDOUT: %require_complete.loc6_17 => constants.%complete_type.8eb
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_type_mismatch.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
- // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
- // CHECK:STDOUT: %D: type = class_type @D [template]
- // CHECK:STDOUT: %IntLiteral.type: type = fn_type @IntLiteral [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: %array_type.6a2: type = array_type %N, %C [symbolic]
- // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
- // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: %require_complete.d82: <witness> = require_complete_type %array_type.6a2 [symbolic]
- // 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.1(%int_32) [template]
- // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.1(%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.41f: <bound method> = bound_method %N, %Convert.956 [symbolic]
- // CHECK:STDOUT: %Convert.specific_fn.122: <specific function> = specific_function %Convert.bound.41f, @Convert.2(%int_32) [symbolic]
- // CHECK:STDOUT: %int.convert_checked: init %i32 = call %Convert.specific_fn.122(%N) [symbolic]
- // CHECK:STDOUT: %G.type: type = fn_type @G [template]
- // CHECK:STDOUT: %G: %G.type = struct_value () [template]
- // CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [template]
- // CHECK:STDOUT: %array_type.fe4: type = array_type %int_3.1ba, %D [template]
- // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_struct_type, %empty_struct_type, %empty_struct_type) [template]
- // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template]
- // CHECK:STDOUT: %D.val: %D = struct_value () [template]
- // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template]
- // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template]
- // CHECK:STDOUT: %array: %array_type.fe4 = tuple_value (%D.val, %D.val, %D.val) [template]
- // CHECK:STDOUT: %array_type.002: type = array_type %int_3.1ba, %C [template]
- // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F, @F(%int_3.1ba) [template]
- // CHECK:STDOUT: %complete_type.dd1: <witness> = complete_type_witness %array_type.002 [template]
- // CHECK:STDOUT: %Convert.bound.b30: <bound method> = bound_method %int_3.1ba, %Convert.956 [template]
- // CHECK:STDOUT: %Convert.specific_fn.b42: <specific function> = specific_function %Convert.bound.b30, @Convert.2(%int_32) [template]
- // CHECK:STDOUT: %int_3.822: %i32 = int_value 3 [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .IntLiteral = %Core.IntLiteral
- // CHECK:STDOUT: .Int = %Core.Int
- // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/...
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.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: .C = %C.decl
- // CHECK:STDOUT: .D = %D.decl
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: .G = %G.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
- // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} {}
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
- // CHECK:STDOUT: %N.patt.loc7_6.1: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_6.2 (constants.%N.patt)]
- // CHECK:STDOUT: %N.param_patt: Core.IntLiteral = value_param_pattern %N.patt.loc7_6.1, runtime_param<none> [symbolic = %N.patt.loc7_6.2 (constants.%N.patt)]
- // CHECK:STDOUT: %a.patt: @F.%array_type.loc7_37.2 (%array_type.6a2) = binding_pattern a
- // CHECK:STDOUT: %a.param_patt: @F.%array_type.loc7_37.2 (%array_type.6a2) = value_param_pattern %a.patt, runtime_param0
- // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1
- // CHECK:STDOUT: } {
- // 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: %N.param: Core.IntLiteral = value_param runtime_param<none>
- // CHECK:STDOUT: %.loc7_26.1: type = splice_block %.loc7_26.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: %.loc7_26.2: type = value_of_initializer %int_literal.make_type [template = Core.IntLiteral]
- // CHECK:STDOUT: %.loc7_26.3: type = converted %int_literal.make_type, %.loc7_26.2 [template = Core.IntLiteral]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %N.loc7_6.1: Core.IntLiteral = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc7_6.2 (constants.%N)]
- // CHECK:STDOUT: %a.param: @F.%array_type.loc7_37.2 (%array_type.6a2) = value_param runtime_param0
- // CHECK:STDOUT: %.loc7_37: type = splice_block %array_type.loc7_37.1 [symbolic = %array_type.loc7_37.2 (constants.%array_type.6a2)] {
- // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
- // CHECK:STDOUT: %N.ref.loc7_36: Core.IntLiteral = name_ref N, %N.loc7_6.1 [symbolic = %N.loc7_6.2 (constants.%N)]
- // CHECK:STDOUT: %array_type.loc7_37.1: type = array_type %N.ref.loc7_36, %C [symbolic = %array_type.loc7_37.2 (constants.%array_type.6a2)]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: @F.%array_type.loc7_37.2 (%array_type.6a2) = bind_name a, %a.param
- // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1
- // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
- // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param0
- // CHECK:STDOUT: } {
- // 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: %return.param: ref %i32 = out_param runtime_param0
- // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C {
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
- // CHECK:STDOUT: complete_type_witness = %complete_type
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%C
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @D {
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
- // CHECK:STDOUT: complete_type_witness = %complete_type
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%D
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @F(%N.loc7_6.1: Core.IntLiteral) {
- // CHECK:STDOUT: %N.loc7_6.2: Core.IntLiteral = bind_symbolic_name N, 0 [symbolic = %N.loc7_6.2 (constants.%N)]
- // CHECK:STDOUT: %N.patt.loc7_6.2: Core.IntLiteral = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc7_6.2 (constants.%N.patt)]
- // CHECK:STDOUT: %array_type.loc7_37.2: type = array_type %N.loc7_6.2, %C [symbolic = %array_type.loc7_37.2 (constants.%array_type.6a2)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @F.%array_type.loc7_37.2 (%array_type.6a2) [symbolic = %require_complete (constants.%require_complete.d82)]
- // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %N.loc7_6.2, constants.%Convert.956 [symbolic = %Convert.bound (constants.%Convert.bound.41f)]
- // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.2(constants.%int_32) [symbolic = %Convert.specific_fn (constants.%Convert.specific_fn.122)]
- // CHECK:STDOUT: %int.convert_checked.loc7_57.2: init %i32 = call %Convert.specific_fn(%N.loc7_6.2) [symbolic = %int.convert_checked.loc7_57.2 (constants.%int.convert_checked)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn[%N.param_patt: Core.IntLiteral](%a.param_patt: @F.%array_type.loc7_37.2 (%array_type.6a2)) -> %i32 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %N.ref.loc7_56: Core.IntLiteral = name_ref N, %N.loc7_6.1 [symbolic = %N.loc7_6.2 (constants.%N)]
- // 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 %N.ref.loc7_56, %impl.elem0 [symbolic = %Convert.bound (constants.%Convert.bound.41f)]
- // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %bound_method, @Convert.2(constants.%int_32) [symbolic = %Convert.specific_fn (constants.%Convert.specific_fn.122)]
- // CHECK:STDOUT: %int.convert_checked.loc7_57.1: init %i32 = call %specific_fn(%N.ref.loc7_56) [symbolic = %int.convert_checked.loc7_57.2 (constants.%int.convert_checked)]
- // CHECK:STDOUT: %.loc7_57.1: %i32 = value_of_initializer %int.convert_checked.loc7_57.1 [symbolic = %int.convert_checked.loc7_57.2 (constants.%int.convert_checked)]
- // CHECK:STDOUT: %.loc7_57.2: %i32 = converted %N.ref.loc7_56, %.loc7_57.1 [symbolic = %int.convert_checked.loc7_57.2 (constants.%int.convert_checked)]
- // CHECK:STDOUT: return %.loc7_57.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G() -> %i32 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %a.patt: %array_type.fe4 = binding_pattern a
- // CHECK:STDOUT: %.loc11_3.1: %array_type.fe4 = var_pattern %a.patt
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a.var: ref %array_type.fe4 = var a
- // CHECK:STDOUT: %.loc11_21.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc11_25.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc11_29.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc11_30.1: %tuple.type = tuple_literal (%.loc11_21.1, %.loc11_25.1, %.loc11_29.1)
- // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0]
- // CHECK:STDOUT: %.loc11_30.2: ref %D = array_index %a.var, %int_0
- // CHECK:STDOUT: %.loc11_21.2: init %D = class_init (), %.loc11_30.2 [template = constants.%D.val]
- // CHECK:STDOUT: %.loc11_30.3: init %D = converted %.loc11_21.1, %.loc11_21.2 [template = constants.%D.val]
- // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1]
- // CHECK:STDOUT: %.loc11_30.4: ref %D = array_index %a.var, %int_1
- // CHECK:STDOUT: %.loc11_25.2: init %D = class_init (), %.loc11_30.4 [template = constants.%D.val]
- // CHECK:STDOUT: %.loc11_30.5: init %D = converted %.loc11_25.1, %.loc11_25.2 [template = constants.%D.val]
- // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2]
- // CHECK:STDOUT: %.loc11_30.6: ref %D = array_index %a.var, %int_2
- // CHECK:STDOUT: %.loc11_29.2: init %D = class_init (), %.loc11_30.6 [template = constants.%D.val]
- // CHECK:STDOUT: %.loc11_30.7: init %D = converted %.loc11_29.1, %.loc11_29.2 [template = constants.%D.val]
- // CHECK:STDOUT: %.loc11_30.8: init %array_type.fe4 = array_init (%.loc11_30.3, %.loc11_30.5, %.loc11_30.7) to %a.var [template = constants.%array]
- // CHECK:STDOUT: %.loc11_3.2: init %array_type.fe4 = converted %.loc11_30.1, %.loc11_30.8 [template = constants.%array]
- // CHECK:STDOUT: assign %a.var, %.loc11_3.2
- // CHECK:STDOUT: %.loc11_15: type = splice_block %array_type [template = constants.%array_type.fe4] {
- // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D]
- // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template = constants.%int_3.1ba]
- // CHECK:STDOUT: %array_type: type = array_type %int_3, %D [template = constants.%array_type.fe4]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: ref %array_type.fe4 = bind_name a, %a.var
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
- // CHECK:STDOUT: %a.ref: ref %array_type.fe4 = name_ref a, %a
- // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F.ref, @F(constants.%int_3.1ba) [template = constants.%F.specific_fn]
- // CHECK:STDOUT: %.loc22_12: %array_type.002 = converted %a.ref, <error> [template = <error>]
- // CHECK:STDOUT: %F.call: init %i32 = call %F.specific_fn(<error>)
- // CHECK:STDOUT: %.loc22_14.1: %i32 = value_of_initializer %F.call
- // CHECK:STDOUT: %.loc22_14.2: %i32 = converted %F.call, %.loc22_14.1
- // CHECK:STDOUT: return %.loc22_14.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F(constants.%N) {
- // CHECK:STDOUT: %N.loc7_6.2 => constants.%N
- // CHECK:STDOUT: %N.patt.loc7_6.2 => constants.%N
- // CHECK:STDOUT: %array_type.loc7_37.2 => constants.%array_type.6a2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F(constants.%int_3.1ba) {
- // CHECK:STDOUT: %N.loc7_6.2 => constants.%int_3.1ba
- // CHECK:STDOUT: %N.patt.loc7_6.2 => constants.%int_3.1ba
- // CHECK:STDOUT: %array_type.loc7_37.2 => constants.%array_type.002
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %require_complete => constants.%complete_type.dd1
- // CHECK:STDOUT: %Convert.bound => constants.%Convert.bound.b30
- // CHECK:STDOUT: %Convert.specific_fn => constants.%Convert.specific_fn.b42
- // CHECK:STDOUT: %int.convert_checked.loc7_57.2 => constants.%int_3.822
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_bound_type_mismatch.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [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: %N.51e: %i32 = bind_symbolic_name N, 0 [symbolic]
- // CHECK:STDOUT: %N.patt.8e2: %i32 = symbolic_binding_pattern N, 0 [symbolic]
- // CHECK:STDOUT: %ImplicitAs.type.2fd: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [template]
- // CHECK:STDOUT: %Convert.type.71e: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template]
- // CHECK:STDOUT: %impl_witness.023: <witness> = impl_witness (imports.%Core.import_ref.85c), @impl.2(%int_32) [template]
- // CHECK:STDOUT: %Convert.type.4ad: type = fn_type @Convert.3, @impl.2(%int_32) [template]
- // CHECK:STDOUT: %Convert.960: %Convert.type.4ad = struct_value () [template]
- // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.2fd = facet_value %i32, %impl_witness.023 [template]
- // CHECK:STDOUT: %.10e: type = fn_type_with_self_type %Convert.type.71e, %ImplicitAs.facet [template]
- // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %N.51e, %Convert.960 [symbolic]
- // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.3(%int_32) [symbolic]
- // CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %Convert.specific_fn(%N.51e) [symbolic]
- // CHECK:STDOUT: %array_type.c13: type = array_type %int.convert_checked, %C [symbolic]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: %require_complete.303: <witness> = require_complete_type %array_type.c13 [symbolic]
- // CHECK:STDOUT: %G.type: type = fn_type @G [template]
- // CHECK:STDOUT: %G: %G.type = struct_value () [template]
- // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template]
- // CHECK:STDOUT: %array_type.002: type = array_type %int_3, %C [template]
- // CHECK:STDOUT: %tuple.type: type = tuple_type (%empty_struct_type, %empty_struct_type, %empty_struct_type) [template]
- // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template]
- // CHECK:STDOUT: %C.val: %C = struct_value () [template]
- // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template]
- // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template]
- // CHECK:STDOUT: %array: %array_type.002 = tuple_value (%C.val, %C.val, %C.val) [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: .C = %C.decl
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: .G = %G.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
- // CHECK:STDOUT: %N.patt.loc6_6.1: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_6.2 (constants.%N.patt.8e2)]
- // CHECK:STDOUT: %N.param_patt: %i32 = value_param_pattern %N.patt.loc6_6.1, runtime_param<none> [symbolic = %N.patt.loc6_6.2 (constants.%N.patt.8e2)]
- // CHECK:STDOUT: %a.patt: @F.%array_type.loc6_23.2 (%array_type.c13) = binding_pattern a
- // CHECK:STDOUT: %a.param_patt: @F.%array_type.loc6_23.2 (%array_type.c13) = value_param_pattern %a.patt, runtime_param0
- // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %int_32.loc6_29: Core.IntLiteral = int_value 32 [template = constants.%int_32]
- // CHECK:STDOUT: %i32.loc6_29: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
- // CHECK:STDOUT: %N.param: %i32 = value_param runtime_param<none>
- // CHECK:STDOUT: %.loc6_10: type = splice_block %i32.loc6_10 [template = constants.%i32] {
- // CHECK:STDOUT: %int_32.loc6_10: Core.IntLiteral = int_value 32 [template = constants.%int_32]
- // CHECK:STDOUT: %i32.loc6_10: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %N.loc6_6.1: %i32 = bind_symbolic_name N, 0, %N.param [symbolic = %N.loc6_6.2 (constants.%N.51e)]
- // CHECK:STDOUT: %a.param: @F.%array_type.loc6_23.2 (%array_type.c13) = value_param runtime_param0
- // CHECK:STDOUT: %.loc6_23: type = splice_block %array_type.loc6_23.1 [symbolic = %array_type.loc6_23.2 (constants.%array_type.c13)] {
- // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
- // CHECK:STDOUT: %N.ref.loc6_22: %i32 = name_ref N, %N.loc6_6.1 [symbolic = %N.loc6_6.2 (constants.%N.51e)]
- // CHECK:STDOUT: %impl.elem0: %.10e = impl_witness_access constants.%impl_witness.023, element0 [template = constants.%Convert.960]
- // CHECK:STDOUT: %bound_method: <bound method> = bound_method %N.ref.loc6_22, %impl.elem0 [symbolic = %Convert.bound (constants.%Convert.bound)]
- // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %bound_method, @Convert.3(constants.%int_32) [symbolic = %Convert.specific_fn (constants.%Convert.specific_fn)]
- // CHECK:STDOUT: %int.convert_checked.loc6_22.1: init Core.IntLiteral = call %specific_fn(%N.ref.loc6_22) [symbolic = %int.convert_checked.loc6_22.2 (constants.%int.convert_checked)]
- // CHECK:STDOUT: %.loc6_22.1: Core.IntLiteral = value_of_initializer %int.convert_checked.loc6_22.1 [symbolic = %int.convert_checked.loc6_22.2 (constants.%int.convert_checked)]
- // CHECK:STDOUT: %.loc6_22.2: Core.IntLiteral = converted %N.ref.loc6_22, %.loc6_22.1 [symbolic = %int.convert_checked.loc6_22.2 (constants.%int.convert_checked)]
- // CHECK:STDOUT: %array_type.loc6_23.1: type = array_type %.loc6_22.2, %C [symbolic = %array_type.loc6_23.2 (constants.%array_type.c13)]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: @F.%array_type.loc6_23.2 (%array_type.c13) = bind_name a, %a.param
- // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1
- // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
- // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
- // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param0
- // CHECK:STDOUT: } {
- // 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: %return.param: ref %i32 = out_param runtime_param0
- // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C {
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
- // CHECK:STDOUT: complete_type_witness = %complete_type
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%C
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @F(%N.loc6_6.1: %i32) {
- // CHECK:STDOUT: %N.loc6_6.2: %i32 = bind_symbolic_name N, 0 [symbolic = %N.loc6_6.2 (constants.%N.51e)]
- // CHECK:STDOUT: %N.patt.loc6_6.2: %i32 = symbolic_binding_pattern N, 0 [symbolic = %N.patt.loc6_6.2 (constants.%N.patt.8e2)]
- // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %N.loc6_6.2, constants.%Convert.960 [symbolic = %Convert.bound (constants.%Convert.bound)]
- // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.bound, @Convert.3(constants.%int_32) [symbolic = %Convert.specific_fn (constants.%Convert.specific_fn)]
- // CHECK:STDOUT: %int.convert_checked.loc6_22.2: init Core.IntLiteral = call %Convert.specific_fn(%N.loc6_6.2) [symbolic = %int.convert_checked.loc6_22.2 (constants.%int.convert_checked)]
- // CHECK:STDOUT: %array_type.loc6_23.2: type = array_type %int.convert_checked.loc6_22.2, %C [symbolic = %array_type.loc6_23.2 (constants.%array_type.c13)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @F.%array_type.loc6_23.2 (%array_type.c13) [symbolic = %require_complete (constants.%require_complete.303)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn[%N.param_patt: %i32](%a.param_patt: @F.%array_type.loc6_23.2 (%array_type.c13)) -> %i32 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %N.ref.loc6_42: %i32 = name_ref N, %N.loc6_6.1 [symbolic = %N.loc6_6.2 (constants.%N.51e)]
- // CHECK:STDOUT: return %N.ref.loc6_42
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G() -> %i32 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %a.patt: %array_type.002 = binding_pattern a
- // CHECK:STDOUT: %.loc9_3.1: %array_type.002 = var_pattern %a.patt
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a.var: ref %array_type.002 = var a
- // CHECK:STDOUT: %.loc9_21.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc9_25.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc9_29.1: %empty_struct_type = struct_literal ()
- // CHECK:STDOUT: %.loc9_30.1: %tuple.type = tuple_literal (%.loc9_21.1, %.loc9_25.1, %.loc9_29.1)
- // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [template = constants.%int_0]
- // CHECK:STDOUT: %.loc9_30.2: ref %C = array_index %a.var, %int_0
- // CHECK:STDOUT: %.loc9_21.2: init %C = class_init (), %.loc9_30.2 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc9_30.3: init %C = converted %.loc9_21.1, %.loc9_21.2 [template = constants.%C.val]
- // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1]
- // CHECK:STDOUT: %.loc9_30.4: ref %C = array_index %a.var, %int_1
- // CHECK:STDOUT: %.loc9_25.2: init %C = class_init (), %.loc9_30.4 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc9_30.5: init %C = converted %.loc9_25.1, %.loc9_25.2 [template = constants.%C.val]
- // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [template = constants.%int_2]
- // CHECK:STDOUT: %.loc9_30.6: ref %C = array_index %a.var, %int_2
- // CHECK:STDOUT: %.loc9_29.2: init %C = class_init (), %.loc9_30.6 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc9_30.7: init %C = converted %.loc9_29.1, %.loc9_29.2 [template = constants.%C.val]
- // CHECK:STDOUT: %.loc9_30.8: init %array_type.002 = array_init (%.loc9_30.3, %.loc9_30.5, %.loc9_30.7) to %a.var [template = constants.%array]
- // CHECK:STDOUT: %.loc9_3.2: init %array_type.002 = converted %.loc9_30.1, %.loc9_30.8 [template = constants.%array]
- // CHECK:STDOUT: assign %a.var, %.loc9_3.2
- // CHECK:STDOUT: %.loc9_15: type = splice_block %array_type [template = constants.%array_type.002] {
- // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
- // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [template = constants.%int_3]
- // CHECK:STDOUT: %array_type: type = array_type %int_3, %C [template = constants.%array_type.002]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %a: ref %array_type.002 = bind_name a, %a.var
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
- // CHECK:STDOUT: %a.ref: ref %array_type.002 = name_ref a, %a
- // CHECK:STDOUT: return <error>
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F(constants.%N.51e) {
- // CHECK:STDOUT: %N.loc6_6.2 => constants.%N.51e
- // CHECK:STDOUT: %N.patt.loc6_6.2 => constants.%N.51e
- // CHECK:STDOUT: %Convert.bound => constants.%Convert.bound
- // CHECK:STDOUT: %Convert.specific_fn => constants.%Convert.specific_fn
- // CHECK:STDOUT: %int.convert_checked.loc6_22.2 => constants.%int.convert_checked
- // CHECK:STDOUT: %array_type.loc6_23.2 => constants.%array_type.c13
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
|