| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924 |
- // 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/class/generic/import.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/import.carbon
- // --- foo.carbon
- library "[[@TEST_NAME]]";
- class Class(T:! type);
- class CompleteClass(T:! type) {
- var n: i32;
- fn F() -> i32 { return 0; }
- }
- fn F() -> CompleteClass(i32);
- // --- foo.impl.carbon
- impl library "[[@TEST_NAME]]";
- class Class(T:! type) {
- var x: T;
- }
- fn F() -> CompleteClass(i32) {
- return {.n = 1};
- }
- // --- use_foo.carbon
- library "[[@TEST_NAME]]";
- import library "foo";
- fn UseMethod() -> i32 {
- var v: CompleteClass(i32) = F();
- return v.F();
- }
- fn UseField() -> i32 {
- var v: CompleteClass(i32) = F();
- return v.n;
- }
- // --- fail_generic_arg_mismatch.carbon
- library "[[@TEST_NAME]]";
- import library "foo";
- fn Use() {
- // TODO: Include the generic arguments in the formatted type name.
- // CHECK:STDERR: fail_generic_arg_mismatch.carbon:[[@LINE+7]]:3: error: cannot implicitly convert from `CompleteClass` to `CompleteClass`
- // CHECK:STDERR: var v: CompleteClass(i32*) = F();
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR: fail_generic_arg_mismatch.carbon:[[@LINE+4]]:3: note: type `CompleteClass` does not implement interface `ImplicitAs`
- // CHECK:STDERR: var v: CompleteClass(i32*) = F();
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- var v: CompleteClass(i32*) = F();
- }
- // --- fail_foo.impl.carbon
- impl library "[[@TEST_NAME]]";
- // CHECK:STDERR: fail_foo.impl.carbon:[[@LINE+8]]:13: error: redeclaration differs at parameter 1
- // CHECK:STDERR: class Class(U:! type) {
- // CHECK:STDERR: ^~~~~~~~
- // CHECK:STDERR: fail_foo.impl.carbon:[[@LINE-5]]:6: in import
- // CHECK:STDERR: foo.carbon:4:13: note: previous declaration's corresponding parameter here
- // CHECK:STDERR: class Class(T:! type);
- // CHECK:STDERR: ^~~~~~~~
- // CHECK:STDERR:
- class Class(U:! type) {
- // CHECK:STDERR: fail_foo.impl.carbon:[[@LINE+3]]:10: error: name `T` not found
- // CHECK:STDERR: var x: T;
- // CHECK:STDERR: ^
- var x: T;
- }
- // CHECK:STDOUT: --- foo.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
- // CHECK:STDOUT: %T.patt.1: type = symbolic_binding_pattern T, 0 [symbolic]
- // CHECK:STDOUT: %Class.type: type = generic_class_type @Class [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %Class.1: %Class.type = struct_value () [template]
- // CHECK:STDOUT: %Class.2: type = class_type @Class, @Class(%T) [symbolic]
- // CHECK:STDOUT: %T.patt.2: type = symbolic_binding_pattern T, 0 [symbolic]
- // CHECK:STDOUT: %CompleteClass.type: type = generic_class_type @CompleteClass [template]
- // CHECK:STDOUT: %CompleteClass.1: %CompleteClass.type = struct_value () [template]
- // CHECK:STDOUT: %CompleteClass.2: type = class_type @CompleteClass, @CompleteClass(%T) [symbolic]
- // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
- // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
- // CHECK:STDOUT: %.2: type = unbound_element_type %CompleteClass.2, i32 [symbolic]
- // CHECK:STDOUT: %F.type.1: type = fn_type @F.1, @CompleteClass(%T) [symbolic]
- // CHECK:STDOUT: %F.1: %F.type.1 = struct_value () [symbolic]
- // CHECK:STDOUT: %.3: type = struct_type {.n: i32} [template]
- // CHECK:STDOUT: %.4: <witness> = complete_type_witness %.3 [template]
- // CHECK:STDOUT: %.5: i32 = int_literal 0 [template]
- // CHECK:STDOUT: %CompleteClass.3: type = class_type @CompleteClass, @CompleteClass(i32) [template]
- // CHECK:STDOUT: %F.type.2: type = fn_type @F.2 [template]
- // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .Int32 = %import_ref
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/operators
- // CHECK:STDOUT: import Core//prelude/types
- // CHECK:STDOUT: import Core//prelude/operators/arithmetic
- // CHECK:STDOUT: import Core//prelude/operators/as
- // CHECK:STDOUT: import Core//prelude/operators/bitwise
- // CHECK:STDOUT: import Core//prelude/operators/comparison
- // CHECK:STDOUT: import Core//prelude/types/bool
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .Class = %Class.decl
- // CHECK:STDOUT: .CompleteClass = %CompleteClass.decl
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [template = constants.%Class.1] {
- // CHECK:STDOUT: %T.patt.loc4_13.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_13.2 (constants.%T.patt.1)]
- // CHECK:STDOUT: %T.param_patt: type = param_pattern %T.patt.loc4_13.1, runtime_param<invalid> [symbolic = %T.patt.loc4_13.2 (constants.%T.patt.1)]
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %param: type = param runtime_param<invalid>
- // CHECK:STDOUT: %T.loc4_13.1: type = bind_symbolic_name T, 0, %param [symbolic = %T.loc4_13.2 (constants.%T)]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %CompleteClass.decl: %CompleteClass.type = class_decl @CompleteClass [template = constants.%CompleteClass.1] {
- // CHECK:STDOUT: %T.patt.loc6_21.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_21.2 (constants.%T.patt.2)]
- // CHECK:STDOUT: %T.param_patt: type = param_pattern %T.patt.loc6_21.1, runtime_param<invalid> [symbolic = %T.patt.loc6_21.2 (constants.%T.patt.2)]
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %param: type = param runtime_param<invalid>
- // CHECK:STDOUT: %T.loc6_21.1: type = bind_symbolic_name T, 0, %param [symbolic = %T.loc6_21.2 (constants.%T)]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %F.decl: %F.type.2 = fn_decl @F.2 [template = constants.%F.2] {} {
- // CHECK:STDOUT: %CompleteClass.ref: %CompleteClass.type = name_ref CompleteClass, file.%CompleteClass.decl [template = constants.%CompleteClass.1]
- // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc11_24.1: type = value_of_initializer %int.make_type_32 [template = i32]
- // CHECK:STDOUT: %.loc11_24.2: type = converted %int.make_type_32, %.loc11_24.1 [template = i32]
- // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(i32) [template = constants.%CompleteClass.3]
- // CHECK:STDOUT: %return: ref %CompleteClass.3 = var <return slot>
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic class @Class(%T.loc4_13.1: type) {
- // CHECK:STDOUT: %T.loc4_13.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.2 (constants.%T)]
- // CHECK:STDOUT: %T.patt.loc4_13.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_13.2 (constants.%T.patt.1)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: class;
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic class @CompleteClass(%T.loc6_21.1: type) {
- // CHECK:STDOUT: %T.loc6_21.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_21.2 (constants.%T)]
- // CHECK:STDOUT: %T.patt.loc6_21.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_21.2 (constants.%T.patt.2)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(%T.loc6_21.2) [symbolic = %CompleteClass (constants.%CompleteClass.2)]
- // CHECK:STDOUT: %.loc7_8.2: type = unbound_element_type @CompleteClass.%CompleteClass (%CompleteClass.2), i32 [symbolic = %.loc7_8.2 (constants.%.2)]
- // CHECK:STDOUT: %F.type: type = fn_type @F.1, @CompleteClass(%T.loc6_21.2) [symbolic = %F.type (constants.%F.type.1)]
- // CHECK:STDOUT: %F: @CompleteClass.%F.type (%F.type.1) = struct_value () [symbolic = %F (constants.%F.1)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: class {
- // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc7_10.1: type = value_of_initializer %int.make_type_32 [template = i32]
- // CHECK:STDOUT: %.loc7_10.2: type = converted %int.make_type_32, %.loc7_10.1 [template = i32]
- // CHECK:STDOUT: %.loc7_8.1: @CompleteClass.%.loc7_8.2 (%.2) = field_decl n, element0 [template]
- // CHECK:STDOUT: %F.decl: @CompleteClass.%F.type (%F.type.1) = fn_decl @F.1 [symbolic = @CompleteClass.%F (constants.%F.1)] {} {
- // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32 [template = i32]
- // CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32, %.loc8_13.1 [template = i32]
- // CHECK:STDOUT: %return: ref i32 = var <return slot>
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %.loc9: <witness> = complete_type_witness %.3 [template = constants.%.4]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%CompleteClass.2
- // CHECK:STDOUT: .n = %.loc7_8.1
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @F.1(@CompleteClass.%T.loc6_21.1: type) {
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn() -> i32 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %.loc8_26: i32 = int_literal 0 [template = constants.%.5]
- // CHECK:STDOUT: return %.loc8_26
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F.2() -> %CompleteClass.3;
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @Class(constants.%T) {
- // CHECK:STDOUT: %T.loc4_13.2 => constants.%T
- // CHECK:STDOUT: %T.patt.loc4_13.2 => constants.%T
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @CompleteClass(constants.%T) {
- // CHECK:STDOUT: %T.loc6_21.2 => constants.%T
- // CHECK:STDOUT: %T.patt.loc6_21.2 => constants.%T
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %CompleteClass => constants.%CompleteClass.2
- // CHECK:STDOUT: %.loc7_8.2 => constants.%.2
- // CHECK:STDOUT: %F.type => constants.%F.type.1
- // CHECK:STDOUT: %F => constants.%F.1
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F.1(constants.%T) {}
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @CompleteClass(@CompleteClass.%T.loc6_21.2) {
- // CHECK:STDOUT: %T.loc6_21.2 => constants.%T
- // CHECK:STDOUT: %T.patt.loc6_21.2 => constants.%T
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @CompleteClass(i32) {
- // CHECK:STDOUT: %T.loc6_21.2 => i32
- // CHECK:STDOUT: %T.patt.loc6_21.2 => i32
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- foo.impl.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
- // CHECK:STDOUT: %T.patt.1: type = symbolic_binding_pattern T, 0 [symbolic]
- // CHECK:STDOUT: %Class.type: type = generic_class_type @Class [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %Class.1: %Class.type = struct_value () [template]
- // CHECK:STDOUT: %Class.2: type = class_type @Class, @Class(%T) [symbolic]
- // CHECK:STDOUT: %T.patt.2: type = symbolic_binding_pattern T, 0 [symbolic]
- // CHECK:STDOUT: %.2: type = unbound_element_type %Class.2, %T [symbolic]
- // CHECK:STDOUT: %.3: type = struct_type {.x: %T} [symbolic]
- // CHECK:STDOUT: %.4: <witness> = complete_type_witness %.3 [symbolic]
- // CHECK:STDOUT: %CompleteClass.type: type = generic_class_type @CompleteClass [template]
- // CHECK:STDOUT: %CompleteClass.1: %CompleteClass.type = struct_value () [template]
- // CHECK:STDOUT: %.5: type = struct_type {.n: i32} [template]
- // CHECK:STDOUT: %.6: <witness> = complete_type_witness %.5 [template]
- // CHECK:STDOUT: %CompleteClass.2: type = class_type @CompleteClass, @CompleteClass(%T) [symbolic]
- // CHECK:STDOUT: %.7: type = unbound_element_type %CompleteClass.2, i32 [symbolic]
- // CHECK:STDOUT: %F.type.1: type = fn_type @F.1, @CompleteClass(%T) [symbolic]
- // CHECK:STDOUT: %F.1: %F.type.1 = struct_value () [symbolic]
- // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
- // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
- // CHECK:STDOUT: %CompleteClass.3: type = class_type @CompleteClass, @CompleteClass(i32) [template]
- // CHECK:STDOUT: %F.type.2: type = fn_type @F.2 [template]
- // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [template]
- // CHECK:STDOUT: %.8: type = unbound_element_type %CompleteClass.3, i32 [template]
- // CHECK:STDOUT: %F.type.3: type = fn_type @F.1, @CompleteClass(i32) [template]
- // CHECK:STDOUT: %F.3: %F.type.3 = struct_value () [template]
- // CHECK:STDOUT: %.9: type = ptr_type %.5 [template]
- // CHECK:STDOUT: %.10: i32 = int_literal 1 [template]
- // CHECK:STDOUT: %struct: %CompleteClass.3 = struct_value (%.10) [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %import_ref.1: %Class.type = import_ref Main//foo, inst+9, loaded [template = constants.%Class.1]
- // CHECK:STDOUT: %import_ref.2: %CompleteClass.type = import_ref Main//foo, inst+21, loaded [template = constants.%CompleteClass.1]
- // CHECK:STDOUT: %import_ref.3: %F.type.2 = import_ref Main//foo, inst+63, loaded [template = constants.%F.2]
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .Int32 = %import_ref.7
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/operators
- // CHECK:STDOUT: import Core//prelude/types
- // CHECK:STDOUT: import Core//prelude/operators/arithmetic
- // CHECK:STDOUT: import Core//prelude/operators/as
- // CHECK:STDOUT: import Core//prelude/operators/bitwise
- // CHECK:STDOUT: import Core//prelude/operators/comparison
- // CHECK:STDOUT: import Core//prelude/types/bool
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref.4 = import_ref Main//foo, inst+26, unloaded
- // CHECK:STDOUT: %import_ref.5 = import_ref Main//foo, inst+36, unloaded
- // CHECK:STDOUT: %import_ref.6 = import_ref Main//foo, inst+43, unloaded
- // CHECK:STDOUT: %import_ref.7: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .Class = %Class.decl
- // CHECK:STDOUT: .CompleteClass = imports.%import_ref.2
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
- // CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [template = constants.%Class.1] {
- // CHECK:STDOUT: %T.patt.loc4: type = symbolic_binding_pattern T, 0 [symbolic = constants.%T.patt.1]
- // CHECK:STDOUT: %T.param_patt: type = param_pattern %T.patt.loc4, runtime_param<invalid> [symbolic = constants.%T.patt.1]
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %param: type = param runtime_param<invalid>
- // CHECK:STDOUT: %T.loc4: type = bind_symbolic_name T, 0, %param [symbolic = constants.%T]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %F.decl: %F.type.2 = fn_decl @F.2 [template = constants.%F.2] {} {
- // CHECK:STDOUT: %CompleteClass.ref: %CompleteClass.type = name_ref CompleteClass, imports.%import_ref.2 [template = constants.%CompleteClass.1]
- // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc8_24.1: type = value_of_initializer %int.make_type_32 [template = i32]
- // CHECK:STDOUT: %.loc8_24.2: type = converted %int.make_type_32, %.loc8_24.1 [template = i32]
- // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(i32) [template = constants.%CompleteClass.3]
- // CHECK:STDOUT: %return: ref %CompleteClass.3 = var <return slot>
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic class @Class(constants.%T: type) {
- // CHECK:STDOUT: %T.1: type = bind_symbolic_name T, 0 [symbolic = %T.1 (constants.%T)]
- // CHECK:STDOUT: %T.patt.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.1 (constants.%T.patt.2)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T.1) [symbolic = %Class (constants.%Class.2)]
- // CHECK:STDOUT: %.loc5_8.2: type = unbound_element_type @Class.%Class (%Class.2), @Class.%T.1 (%T) [symbolic = %.loc5_8.2 (constants.%.2)]
- // CHECK:STDOUT: %.loc6_1.2: type = struct_type {.x: @Class.%T.1 (%T)} [symbolic = %.loc6_1.2 (constants.%.3)]
- // CHECK:STDOUT: %.loc6_1.3: <witness> = complete_type_witness @Class.%.loc6_1.2 (%.3) [symbolic = %.loc6_1.3 (constants.%.4)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: class {
- // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4 [symbolic = %T.1 (constants.%T)]
- // CHECK:STDOUT: %.loc5_8.1: @Class.%.loc5_8.2 (%.2) = field_decl x, element0 [template]
- // CHECK:STDOUT: %.loc6_1.1: <witness> = complete_type_witness %.3 [symbolic = %.loc6_1.3 (constants.%.4)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%Class.2
- // CHECK:STDOUT: .x = %.loc5_8.1
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic class @CompleteClass(constants.%T: type) {
- // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
- // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt.2)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(%T) [symbolic = %CompleteClass (constants.%CompleteClass.2)]
- // CHECK:STDOUT: %.1: type = unbound_element_type @CompleteClass.%CompleteClass (%CompleteClass.2), i32 [symbolic = %.1 (constants.%.7)]
- // CHECK:STDOUT: %F.type: type = fn_type @F.1, @CompleteClass(%T) [symbolic = %F.type (constants.%F.type.1)]
- // CHECK:STDOUT: %F: @CompleteClass.%F.type (%F.type.1) = struct_value () [symbolic = %F (constants.%F.1)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: class {
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = imports.%import_ref.4
- // CHECK:STDOUT: .n = imports.%import_ref.5
- // CHECK:STDOUT: .F = imports.%import_ref.6
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @F.1(constants.%T: type) {
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn() -> i32;
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F.2() -> %return: %CompleteClass.3 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %.loc9_16: i32 = int_literal 1 [template = constants.%.10]
- // CHECK:STDOUT: %.loc9_17.1: %.5 = struct_literal (%.loc9_16)
- // CHECK:STDOUT: %.loc9_17.2: ref i32 = class_element_access %return, element0
- // CHECK:STDOUT: %.loc9_17.3: init i32 = initialize_from %.loc9_16 to %.loc9_17.2 [template = constants.%.10]
- // CHECK:STDOUT: %.loc9_17.4: init %CompleteClass.3 = class_init (%.loc9_17.3), %return [template = constants.%struct]
- // CHECK:STDOUT: %.loc9_18: init %CompleteClass.3 = converted %.loc9_17.1, %.loc9_17.4 [template = constants.%struct]
- // CHECK:STDOUT: return %.loc9_18 to %return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @Class(constants.%T) {
- // CHECK:STDOUT: %T.1 => constants.%T
- // CHECK:STDOUT: %T.patt.1 => constants.%T
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @Class(@Class.%T.1) {
- // CHECK:STDOUT: %T.1 => constants.%T
- // CHECK:STDOUT: %T.patt.1 => constants.%T
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @CompleteClass(constants.%T) {
- // CHECK:STDOUT: %T => constants.%T
- // CHECK:STDOUT: %T.patt => constants.%T
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %CompleteClass => constants.%CompleteClass.2
- // CHECK:STDOUT: %.1 => constants.%.7
- // CHECK:STDOUT: %F.type => constants.%F.type.1
- // CHECK:STDOUT: %F => constants.%F.1
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @CompleteClass(@CompleteClass.%T) {
- // CHECK:STDOUT: %T => constants.%T
- // CHECK:STDOUT: %T.patt => constants.%T
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F.1(constants.%T) {}
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @CompleteClass(i32) {
- // CHECK:STDOUT: %T => i32
- // CHECK:STDOUT: %T.patt => i32
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %CompleteClass => constants.%CompleteClass.3
- // CHECK:STDOUT: %.1 => constants.%.8
- // CHECK:STDOUT: %F.type => constants.%F.type.3
- // CHECK:STDOUT: %F => constants.%F.3
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- use_foo.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
- // CHECK:STDOUT: %UseMethod.type: type = fn_type @UseMethod [template]
- // CHECK:STDOUT: %UseMethod: %UseMethod.type = struct_value () [template]
- // CHECK:STDOUT: %CompleteClass.type: type = generic_class_type @CompleteClass [template]
- // CHECK:STDOUT: %CompleteClass.1: %CompleteClass.type = struct_value () [template]
- // CHECK:STDOUT: %.2: type = struct_type {.n: i32} [template]
- // CHECK:STDOUT: %.3: <witness> = complete_type_witness %.2 [template]
- // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
- // CHECK:STDOUT: %CompleteClass.2: type = class_type @CompleteClass, @CompleteClass(%T) [symbolic]
- // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
- // CHECK:STDOUT: %.4: type = unbound_element_type %CompleteClass.2, i32 [symbolic]
- // CHECK:STDOUT: %F.type.1: type = fn_type @F.1, @CompleteClass(%T) [symbolic]
- // CHECK:STDOUT: %F.1: %F.type.1 = struct_value () [symbolic]
- // CHECK:STDOUT: %CompleteClass.3: type = class_type @CompleteClass, @CompleteClass(i32) [template]
- // CHECK:STDOUT: %.5: type = unbound_element_type %CompleteClass.3, i32 [template]
- // CHECK:STDOUT: %F.type.2: type = fn_type @F.1, @CompleteClass(i32) [template]
- // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [template]
- // CHECK:STDOUT: %.6: type = ptr_type %.2 [template]
- // CHECK:STDOUT: %F.type.3: type = fn_type @F.2 [template]
- // CHECK:STDOUT: %F.3: %F.type.3 = struct_value () [template]
- // CHECK:STDOUT: %.7: <specific function> = specific_function %F.2, @F.1(i32) [template]
- // CHECK:STDOUT: %UseField.type: type = fn_type @UseField [template]
- // CHECK:STDOUT: %UseField: %UseField.type = struct_value () [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %import_ref.1 = import_ref Main//foo, inst+9, unloaded
- // CHECK:STDOUT: %import_ref.2: %CompleteClass.type = import_ref Main//foo, inst+21, loaded [template = constants.%CompleteClass.1]
- // CHECK:STDOUT: %import_ref.3: %F.type.3 = import_ref Main//foo, inst+63, loaded [template = constants.%F.3]
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .Int32 = %import_ref.4
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/operators
- // CHECK:STDOUT: import Core//prelude/types
- // CHECK:STDOUT: import Core//prelude/operators/arithmetic
- // CHECK:STDOUT: import Core//prelude/operators/as
- // CHECK:STDOUT: import Core//prelude/operators/bitwise
- // CHECK:STDOUT: import Core//prelude/operators/comparison
- // CHECK:STDOUT: import Core//prelude/types/bool
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref.4: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
- // CHECK:STDOUT: %import_ref.5 = import_ref Main//foo, inst+26, unloaded
- // CHECK:STDOUT: %import_ref.6: @CompleteClass.%.1 (%.4) = import_ref Main//foo, inst+36, loaded [template = %.1]
- // CHECK:STDOUT: %import_ref.7: @CompleteClass.%F.type (%F.type.1) = import_ref Main//foo, inst+43, loaded [symbolic = @CompleteClass.%F (constants.%F.1)]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .Class = imports.%import_ref.1
- // CHECK:STDOUT: .CompleteClass = imports.%import_ref.2
- // CHECK:STDOUT: .F = imports.%import_ref.3
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .UseMethod = %UseMethod.decl
- // CHECK:STDOUT: .UseField = %UseField.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %default.import = import <invalid>
- // CHECK:STDOUT: %UseMethod.decl: %UseMethod.type = fn_decl @UseMethod [template = constants.%UseMethod] {} {
- // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc5_19.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32]
- // CHECK:STDOUT: %.loc5_19.2: type = converted %int.make_type_32.loc5, %.loc5_19.1 [template = i32]
- // CHECK:STDOUT: %return: ref i32 = var <return slot>
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %UseField.decl: %UseField.type = fn_decl @UseField [template = constants.%UseField] {} {
- // CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc10_18.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32]
- // CHECK:STDOUT: %.loc10_18.2: type = converted %int.make_type_32.loc10, %.loc10_18.1 [template = i32]
- // CHECK:STDOUT: %return: ref i32 = var <return slot>
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic class @CompleteClass(constants.%T: type) {
- // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
- // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(%T) [symbolic = %CompleteClass (constants.%CompleteClass.2)]
- // CHECK:STDOUT: %.1: type = unbound_element_type @CompleteClass.%CompleteClass (%CompleteClass.2), i32 [symbolic = %.1 (constants.%.4)]
- // CHECK:STDOUT: %F.type: type = fn_type @F.1, @CompleteClass(%T) [symbolic = %F.type (constants.%F.type.1)]
- // CHECK:STDOUT: %F: @CompleteClass.%F.type (%F.type.1) = struct_value () [symbolic = %F (constants.%F.1)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: class {
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = imports.%import_ref.5
- // CHECK:STDOUT: .n = imports.%import_ref.6
- // CHECK:STDOUT: .F = imports.%import_ref.7
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @UseMethod() -> i32 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %CompleteClass.ref: %CompleteClass.type = name_ref CompleteClass, imports.%import_ref.2 [template = constants.%CompleteClass.1]
- // CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc6_23.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32]
- // CHECK:STDOUT: %.loc6_23.2: type = converted %int.make_type_32.loc6, %.loc6_23.1 [template = i32]
- // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(i32) [template = constants.%CompleteClass.3]
- // CHECK:STDOUT: %v.var: ref %CompleteClass.3 = var v
- // CHECK:STDOUT: %v: ref %CompleteClass.3 = bind_name v, %v.var
- // CHECK:STDOUT: %F.ref.loc6: %F.type.3 = name_ref F, imports.%import_ref.3 [template = constants.%F.3]
- // CHECK:STDOUT: %.loc6_7: ref %CompleteClass.3 = splice_block %v.var {}
- // CHECK:STDOUT: %F.call.loc6: init %CompleteClass.3 = call %F.ref.loc6() to %.loc6_7
- // CHECK:STDOUT: assign %v.var, %F.call.loc6
- // CHECK:STDOUT: %v.ref: ref %CompleteClass.3 = name_ref v, %v
- // CHECK:STDOUT: %.loc7_11.1: %F.type.2 = specific_constant imports.%import_ref.7, @CompleteClass(i32) [template = constants.%F.2]
- // CHECK:STDOUT: %F.ref.loc7: %F.type.2 = name_ref F, %.loc7_11.1 [template = constants.%F.2]
- // CHECK:STDOUT: %.loc7_11.2: <specific function> = specific_function %F.ref.loc7, @F.1(i32) [template = constants.%.7]
- // CHECK:STDOUT: %F.call.loc7: init i32 = call %.loc7_11.2()
- // CHECK:STDOUT: %.loc7_15.1: i32 = value_of_initializer %F.call.loc7
- // CHECK:STDOUT: %.loc7_15.2: i32 = converted %F.call.loc7, %.loc7_15.1
- // CHECK:STDOUT: return %.loc7_15.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @F.1(constants.%T: type) {
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn() -> i32;
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F.2() -> %CompleteClass.3;
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @UseField() -> i32 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %CompleteClass.ref: %CompleteClass.type = name_ref CompleteClass, imports.%import_ref.2 [template = constants.%CompleteClass.1]
- // CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc11_23.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32]
- // CHECK:STDOUT: %.loc11_23.2: type = converted %int.make_type_32.loc11, %.loc11_23.1 [template = i32]
- // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(i32) [template = constants.%CompleteClass.3]
- // CHECK:STDOUT: %v.var: ref %CompleteClass.3 = var v
- // CHECK:STDOUT: %v: ref %CompleteClass.3 = bind_name v, %v.var
- // CHECK:STDOUT: %F.ref: %F.type.3 = name_ref F, imports.%import_ref.3 [template = constants.%F.3]
- // CHECK:STDOUT: %.loc11_7: ref %CompleteClass.3 = splice_block %v.var {}
- // CHECK:STDOUT: %F.call: init %CompleteClass.3 = call %F.ref() to %.loc11_7
- // CHECK:STDOUT: assign %v.var, %F.call
- // CHECK:STDOUT: %v.ref: ref %CompleteClass.3 = name_ref v, %v
- // CHECK:STDOUT: %n.ref: %.5 = name_ref n, imports.%import_ref.6 [template = imports.%.1]
- // CHECK:STDOUT: %.loc12_11.1: ref i32 = class_element_access %v.ref, element0
- // CHECK:STDOUT: %.loc12_11.2: i32 = bind_value %.loc12_11.1
- // CHECK:STDOUT: return %.loc12_11.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @CompleteClass(constants.%T) {
- // CHECK:STDOUT: %T => constants.%T
- // CHECK:STDOUT: %T.patt => constants.%T
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %CompleteClass => constants.%CompleteClass.2
- // CHECK:STDOUT: %.1 => constants.%.4
- // CHECK:STDOUT: %F.type => constants.%F.type.1
- // CHECK:STDOUT: %F => constants.%F.1
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @CompleteClass(@CompleteClass.%T) {
- // CHECK:STDOUT: %T => constants.%T
- // CHECK:STDOUT: %T.patt => constants.%T
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F.1(constants.%T) {}
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @CompleteClass(i32) {
- // CHECK:STDOUT: %T => i32
- // CHECK:STDOUT: %T.patt => i32
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %CompleteClass => constants.%CompleteClass.3
- // CHECK:STDOUT: %.1 => constants.%.5
- // CHECK:STDOUT: %F.type => constants.%F.type.2
- // CHECK:STDOUT: %F => constants.%F.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F.1(i32) {
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_generic_arg_mismatch.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %Use.type: type = fn_type @Use [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %Use: %Use.type = struct_value () [template]
- // CHECK:STDOUT: %CompleteClass.type: type = generic_class_type @CompleteClass [template]
- // CHECK:STDOUT: %CompleteClass.1: %CompleteClass.type = struct_value () [template]
- // CHECK:STDOUT: %.2: type = struct_type {.n: i32} [template]
- // CHECK:STDOUT: %.3: <witness> = complete_type_witness %.2 [template]
- // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
- // CHECK:STDOUT: %CompleteClass.2: type = class_type @CompleteClass, @CompleteClass(%T) [symbolic]
- // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
- // CHECK:STDOUT: %.4: type = unbound_element_type %CompleteClass.2, i32 [symbolic]
- // CHECK:STDOUT: %F.type.1: type = fn_type @F.1, @CompleteClass(%T) [symbolic]
- // CHECK:STDOUT: %F.1: %F.type.1 = struct_value () [symbolic]
- // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
- // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
- // CHECK:STDOUT: %.5: type = ptr_type i32 [template]
- // CHECK:STDOUT: %CompleteClass.3: type = class_type @CompleteClass, @CompleteClass(%.5) [template]
- // CHECK:STDOUT: %.6: type = unbound_element_type %CompleteClass.3, i32 [template]
- // CHECK:STDOUT: %F.type.2: type = fn_type @F.1, @CompleteClass(%.5) [template]
- // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [template]
- // CHECK:STDOUT: %.7: type = ptr_type %.2 [template]
- // CHECK:STDOUT: %F.type.3: type = fn_type @F.2 [template]
- // CHECK:STDOUT: %F.3: %F.type.3 = struct_value () [template]
- // CHECK:STDOUT: %CompleteClass.4: type = class_type @CompleteClass, @CompleteClass(i32) [template]
- // CHECK:STDOUT: %.8: type = unbound_element_type %CompleteClass.4, i32 [template]
- // CHECK:STDOUT: %F.type.4: type = fn_type @F.1, @CompleteClass(i32) [template]
- // CHECK:STDOUT: %F.4: %F.type.4 = struct_value () [template]
- // CHECK:STDOUT: %ImplicitAs.type.1: type = generic_interface_type @ImplicitAs [template]
- // CHECK:STDOUT: %ImplicitAs: %ImplicitAs.type.1 = struct_value () [template]
- // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic]
- // CHECK:STDOUT: %ImplicitAs.type.2: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic]
- // CHECK:STDOUT: %Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2) = bind_symbolic_name Self, 1 [symbolic]
- // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic]
- // CHECK:STDOUT: %Self.2: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic]
- // CHECK:STDOUT: %Convert.type.1: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic]
- // CHECK:STDOUT: %Convert.1: %Convert.type.1 = struct_value () [symbolic]
- // CHECK:STDOUT: %.9: type = assoc_entity_type %ImplicitAs.type.2, %Convert.type.1 [symbolic]
- // CHECK:STDOUT: %.10: %.9 = assoc_entity element0, imports.%import_ref.12 [symbolic]
- // CHECK:STDOUT: %ImplicitAs.type.3: type = interface_type @ImplicitAs, @ImplicitAs(%CompleteClass.3) [template]
- // CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert, @ImplicitAs(%CompleteClass.3) [template]
- // CHECK:STDOUT: %Convert.2: %Convert.type.2 = struct_value () [template]
- // CHECK:STDOUT: %.11: type = assoc_entity_type %ImplicitAs.type.3, %Convert.type.2 [template]
- // CHECK:STDOUT: %.12: %.11 = assoc_entity element0, imports.%import_ref.12 [template]
- // CHECK:STDOUT: %.13: %.9 = assoc_entity element0, imports.%import_ref.13 [symbolic]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %import_ref.1 = import_ref Main//foo, inst+9, unloaded
- // CHECK:STDOUT: %import_ref.2: %CompleteClass.type = import_ref Main//foo, inst+21, loaded [template = constants.%CompleteClass.1]
- // CHECK:STDOUT: %import_ref.3: %F.type.3 = import_ref Main//foo, inst+63, loaded [template = constants.%F.3]
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: .Int32 = %import_ref.7
- // CHECK:STDOUT: .ImplicitAs = %import_ref.8
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/operators
- // CHECK:STDOUT: import Core//prelude/types
- // CHECK:STDOUT: import Core//prelude/operators/arithmetic
- // CHECK:STDOUT: import Core//prelude/operators/as
- // CHECK:STDOUT: import Core//prelude/operators/bitwise
- // CHECK:STDOUT: import Core//prelude/operators/comparison
- // CHECK:STDOUT: import Core//prelude/types/bool
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %import_ref.4 = import_ref Main//foo, inst+26, unloaded
- // CHECK:STDOUT: %import_ref.5 = import_ref Main//foo, inst+36, unloaded
- // CHECK:STDOUT: %import_ref.6 = import_ref Main//foo, inst+43, unloaded
- // CHECK:STDOUT: %import_ref.7: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
- // CHECK:STDOUT: %import_ref.8: %ImplicitAs.type.1 = import_ref Core//prelude/operators/as, inst+46, loaded [template = constants.%ImplicitAs]
- // CHECK:STDOUT: %import_ref.9 = import_ref Core//prelude/operators/as, inst+52, unloaded
- // CHECK:STDOUT: %import_ref.10: @ImplicitAs.%.1 (%.9) = import_ref Core//prelude/operators/as, inst+71, loaded [symbolic = @ImplicitAs.%.2 (constants.%.13)]
- // CHECK:STDOUT: %import_ref.11 = import_ref Core//prelude/operators/as, inst+64, unloaded
- // CHECK:STDOUT: %import_ref.12 = import_ref Core//prelude/operators/as, inst+64, unloaded
- // CHECK:STDOUT: %import_ref.13 = import_ref Core//prelude/operators/as, inst+64, unloaded
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .Class = imports.%import_ref.1
- // CHECK:STDOUT: .CompleteClass = imports.%import_ref.2
- // CHECK:STDOUT: .F = imports.%import_ref.3
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .Use = %Use.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %default.import = import <invalid>
- // CHECK:STDOUT: %Use.decl: %Use.type = fn_decl @Use [template = constants.%Use] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic interface @ImplicitAs(constants.%Dest: type) {
- // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
- // CHECK:STDOUT: %Dest.patt: type = symbolic_binding_pattern Dest, 0 [symbolic = %Dest.patt (constants.%Dest.patt)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
- // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
- // CHECK:STDOUT: %Convert.type: type = fn_type @Convert, @ImplicitAs(%Dest) [symbolic = %Convert.type (constants.%Convert.type.1)]
- // CHECK:STDOUT: %Convert: @ImplicitAs.%Convert.type (%Convert.type.1) = struct_value () [symbolic = %Convert (constants.%Convert.1)]
- // CHECK:STDOUT: %.1: type = assoc_entity_type @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2), @ImplicitAs.%Convert.type (%Convert.type.1) [symbolic = %.1 (constants.%.9)]
- // CHECK:STDOUT: %.2: @ImplicitAs.%.1 (%.9) = assoc_entity element0, imports.%import_ref.12 [symbolic = %.2 (constants.%.10)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: interface {
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = imports.%import_ref.9
- // CHECK:STDOUT: .Convert = imports.%import_ref.10
- // CHECK:STDOUT: witness = (imports.%import_ref.11)
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic class @CompleteClass(constants.%T: type) {
- // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
- // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(%T) [symbolic = %CompleteClass (constants.%CompleteClass.2)]
- // CHECK:STDOUT: %.1: type = unbound_element_type @CompleteClass.%CompleteClass (%CompleteClass.2), i32 [symbolic = %.1 (constants.%.4)]
- // CHECK:STDOUT: %F.type: type = fn_type @F.1, @CompleteClass(%T) [symbolic = %F.type (constants.%F.type.1)]
- // CHECK:STDOUT: %F: @CompleteClass.%F.type (%F.type.1) = struct_value () [symbolic = %F (constants.%F.1)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: class {
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = imports.%import_ref.4
- // CHECK:STDOUT: .n = imports.%import_ref.5
- // CHECK:STDOUT: .F = imports.%import_ref.6
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Use() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %CompleteClass.ref: %CompleteClass.type = name_ref CompleteClass, imports.%import_ref.2 [template = constants.%CompleteClass.1]
- // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc14_27.1: type = value_of_initializer %int.make_type_32 [template = i32]
- // CHECK:STDOUT: %.loc14_27.2: type = converted %int.make_type_32, %.loc14_27.1 [template = i32]
- // CHECK:STDOUT: %.loc14_27.3: type = ptr_type i32 [template = constants.%.5]
- // CHECK:STDOUT: %CompleteClass: type = class_type @CompleteClass, @CompleteClass(constants.%.5) [template = constants.%CompleteClass.3]
- // CHECK:STDOUT: %v.var: ref %CompleteClass.3 = var v
- // CHECK:STDOUT: %v: ref %CompleteClass.3 = bind_name v, %v.var
- // CHECK:STDOUT: %F.ref: %F.type.3 = name_ref F, imports.%import_ref.3 [template = constants.%F.3]
- // CHECK:STDOUT: %.loc14_33.1: ref %CompleteClass.4 = temporary_storage
- // CHECK:STDOUT: %F.call: init %CompleteClass.4 = call %F.ref() to %.loc14_33.1
- // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(constants.%CompleteClass.3) [template = constants.%ImplicitAs.type.3]
- // CHECK:STDOUT: %.loc14_35.1: %.11 = specific_constant imports.%import_ref.10, @ImplicitAs(constants.%CompleteClass.3) [template = constants.%.12]
- // CHECK:STDOUT: %Convert.ref: %.11 = name_ref Convert, %.loc14_35.1 [template = constants.%.12]
- // CHECK:STDOUT: %.loc14_33.2: ref %CompleteClass.4 = temporary %.loc14_33.1, %F.call
- // CHECK:STDOUT: %.loc14_35.2: %CompleteClass.3 = converted %F.call, <error> [template = <error>]
- // CHECK:STDOUT: assign %v.var, <error>
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @F.1(constants.%T: type) {
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn() -> i32;
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F.2() -> %CompleteClass.4;
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @Convert(constants.%Dest: type, constants.%Self.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.2)) {
- // CHECK:STDOUT: %Dest: type = bind_symbolic_name Dest, 0 [symbolic = %Dest (constants.%Dest)]
- // CHECK:STDOUT: %ImplicitAs.type: type = interface_type @ImplicitAs, @ImplicitAs(%Dest) [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.2)]
- // CHECK:STDOUT: %Self: %ImplicitAs.type.2 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.2)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn[%self.param_patt: @Convert.%Self (%Self.2)]() -> @Convert.%Dest (%Dest);
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @CompleteClass(constants.%T) {
- // CHECK:STDOUT: %T => constants.%T
- // CHECK:STDOUT: %T.patt => constants.%T
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %CompleteClass => constants.%CompleteClass.2
- // CHECK:STDOUT: %.1 => constants.%.4
- // CHECK:STDOUT: %F.type => constants.%F.type.1
- // CHECK:STDOUT: %F => constants.%F.1
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @CompleteClass(@CompleteClass.%T) {
- // CHECK:STDOUT: %T => constants.%T
- // CHECK:STDOUT: %T.patt => constants.%T
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @F.1(constants.%T) {}
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @CompleteClass(constants.%.5) {
- // CHECK:STDOUT: %T => constants.%.5
- // CHECK:STDOUT: %T.patt => constants.%.5
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %CompleteClass => constants.%CompleteClass.3
- // CHECK:STDOUT: %.1 => constants.%.6
- // CHECK:STDOUT: %F.type => constants.%F.type.2
- // CHECK:STDOUT: %F => constants.%F.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @CompleteClass(i32) {
- // CHECK:STDOUT: %T => i32
- // CHECK:STDOUT: %T.patt => i32
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %CompleteClass => constants.%CompleteClass.4
- // CHECK:STDOUT: %.1 => constants.%.8
- // CHECK:STDOUT: %F.type => constants.%F.type.4
- // CHECK:STDOUT: %F => constants.%F.4
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @ImplicitAs(constants.%Dest) {
- // CHECK:STDOUT: %Dest => constants.%Dest
- // CHECK:STDOUT: %Dest.patt => constants.%Dest
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @ImplicitAs(@ImplicitAs.%Dest) {
- // CHECK:STDOUT: %Dest => constants.%Dest
- // CHECK:STDOUT: %Dest.patt => constants.%Dest
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @ImplicitAs(@Convert.%Dest) {
- // CHECK:STDOUT: %Dest => constants.%Dest
- // CHECK:STDOUT: %Dest.patt => constants.%Dest
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @Convert(constants.%Dest, constants.%Self.1) {
- // CHECK:STDOUT: %Dest => constants.%Dest
- // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.2
- // CHECK:STDOUT: %Self => constants.%Self.1
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @ImplicitAs(constants.%CompleteClass.3) {
- // CHECK:STDOUT: %Dest => constants.%CompleteClass.3
- // CHECK:STDOUT: %Dest.patt => constants.%CompleteClass.3
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.3
- // CHECK:STDOUT: %Self => constants.%Self.2
- // CHECK:STDOUT: %Convert.type => constants.%Convert.type.2
- // CHECK:STDOUT: %Convert => constants.%Convert.2
- // CHECK:STDOUT: %.1 => constants.%.11
- // CHECK:STDOUT: %.2 => constants.%.12
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_foo.impl.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %U: type = bind_symbolic_name U, 0 [symbolic]
- // CHECK:STDOUT: %U.patt: type = symbolic_binding_pattern U, 0 [symbolic]
- // CHECK:STDOUT: %Class.type: type = generic_class_type @Class [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %Class.1: %Class.type = struct_value () [template]
- // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
- // CHECK:STDOUT: %Class.2: type = class_type @Class, @Class(%T) [symbolic]
- // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
- // CHECK:STDOUT: %.type: type = generic_class_type @.1 [template]
- // CHECK:STDOUT: %.2: %.type = struct_value () [template]
- // CHECK:STDOUT: %.3: type = class_type @.1, @.1(%U) [symbolic]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %import_ref.1: %Class.type = import_ref Main//foo, inst+9, loaded [template = constants.%Class.1]
- // CHECK:STDOUT: %import_ref.2 = import_ref Main//foo, inst+21, unloaded
- // CHECK:STDOUT: %import_ref.3 = import_ref Main//foo, inst+63, unloaded
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/operators
- // CHECK:STDOUT: import Core//prelude/types
- // CHECK:STDOUT: import Core//prelude/operators/arithmetic
- // CHECK:STDOUT: import Core//prelude/operators/as
- // CHECK:STDOUT: import Core//prelude/operators/bitwise
- // CHECK:STDOUT: import Core//prelude/operators/comparison
- // CHECK:STDOUT: import Core//prelude/types/bool
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {
- // CHECK:STDOUT: .Class = imports.%import_ref.1
- // CHECK:STDOUT: .CompleteClass = imports.%import_ref.2
- // CHECK:STDOUT: .F = imports.%import_ref.3
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
- // CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %.decl: %.type = class_decl @.1 [template = constants.%.2] {
- // CHECK:STDOUT: %U.patt.loc12_13.1: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc12_13.2 (constants.%U.patt)]
- // CHECK:STDOUT: %U.param_patt: type = param_pattern %U.patt.loc12_13.1, runtime_param<invalid> [symbolic = %U.patt.loc12_13.2 (constants.%U.patt)]
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %param: type = param runtime_param<invalid>
- // CHECK:STDOUT: %U.loc12_13.1: type = bind_symbolic_name U, 0, %param [symbolic = %U.loc12_13.2 (constants.%U)]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic class @Class(constants.%T: type) {
- // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
- // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: class;
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic class @.1(%U.loc12_13.1: type) {
- // CHECK:STDOUT: %U.loc12_13.2: type = bind_symbolic_name U, 0 [symbolic = %U.loc12_13.2 (constants.%U)]
- // CHECK:STDOUT: %U.patt.loc12_13.2: type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc12_13.2 (constants.%U.patt)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !definition:
- // CHECK:STDOUT:
- // CHECK:STDOUT: class {
- // CHECK:STDOUT: %T.ref: <error> = name_ref T, <error> [template = <error>]
- // CHECK:STDOUT: %.loc16: <error> = field_decl x, element0 [template]
- // CHECK:STDOUT: %.loc17: <witness> = complete_type_witness <error> [template = <error>]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%.3
- // CHECK:STDOUT: .x = %.loc16
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @Class(constants.%T) {
- // CHECK:STDOUT: %T => constants.%T
- // CHECK:STDOUT: %T.patt => constants.%T
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @.1(constants.%U) {
- // CHECK:STDOUT: %U.loc12_13.2 => constants.%U
- // CHECK:STDOUT: %U.patt.loc12_13.2 => constants.%U
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
|