| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281 |
- // 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/inheritance_access.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/inheritance_access.carbon
- // --- instance_protected_field_access.carbon
- library "[[@TEST_NAME]]";
- base class Shape {
- protected var x: i32;
- protected var y: i32;
- }
- class Circle {
- extend base: Shape;
- fn GetPosition[self: Self]() -> (i32, i32) {
- return (self.x, self.y);
- }
- }
- // --- shadowing_access.carbon
- library "[[@TEST_NAME]]";
- base class A {
- fn F();
- }
- base class B {
- extend base: A;
- private fn F() -> i32;
- }
- base class C {
- extend base: B;
- fn G[self: Self]() -> () { return self.F(); }
- }
- // --- inherited_member_access.carbon
- library "[[@TEST_NAME]]";
- base class A {
- protected let SOME_CONSTANT: i32 = 5;
- protected fn SomeProtectedFunction() -> i32 {
- return 5;
- }
- }
- class B {
- extend base: A;
- fn G() -> i32 {
- return A.SOME_CONSTANT;
- }
- fn H() -> i32 {
- return A.SomeProtectedFunction();
- }
- }
- // --- fail_inherited_private_field_access.carbon
- library "[[@TEST_NAME]]";
- base class Shape {
- private var y: i32;
- }
- class Square {
- extend base: Shape;
- fn GetPosition[self: Self]() -> i32 {
- // CHECK:STDERR: fail_inherited_private_field_access.carbon:[[@LINE+7]]:12: error: cannot access private member `y` of type `Shape`
- // CHECK:STDERR: return self.y;
- // CHECK:STDERR: ^~~~~~
- // CHECK:STDERR: fail_inherited_private_field_access.carbon:[[@LINE-10]]:15: note: declared here
- // CHECK:STDERR: private var y: i32;
- // CHECK:STDERR: ^~~~~~
- // CHECK:STDERR:
- return self.y;
- }
- }
- // --- noninstance_private_on_self.carbon
- library "[[@TEST_NAME]]";
- class C {
- private fn F() {}
- fn G() { Self.F(); }
- }
- // --- noninstance_protected_on_self.carbon
- library "[[@TEST_NAME]]";
- class C {
- protected fn F() {}
- fn G() { Self.F(); }
- }
- // --- fail_noninstance_private_on_parent.carbon
- library "[[@TEST_NAME]]";
- base class B {
- private fn F() {}
- }
- class C {
- extend base: B;
- // CHECK:STDERR: fail_noninstance_private_on_parent.carbon:[[@LINE+7]]:12: error: cannot access private member `F` of type `B`
- // CHECK:STDERR: fn G() { Self.F(); }
- // CHECK:STDERR: ^~~~~~
- // CHECK:STDERR: fail_noninstance_private_on_parent.carbon:[[@LINE-8]]:3: note: declared here
- // CHECK:STDERR: private fn F() {}
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- fn G() { Self.F(); }
- }
- // --- noninstance_protected_on_parent.carbon
- library "[[@TEST_NAME]]";
- base class B {
- protected fn F() {}
- }
- class C {
- extend base: B;
- fn G() { Self.F(); }
- }
- // --- fail_non_inherited_access.carbon
- library "[[@TEST_NAME]]";
- base class A {
- protected let SOME_PROTECTED_CONSTANT: i32 = 5;
- private let SOME_PRIVATE_CONSTANT: i32 = 5;
- }
- base class Internal {
- protected let INTERNAL_CONSTANT: i32 = 5;
- }
- class B {
- private var internal: Internal;
- fn G() -> i32 {
- // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE+7]]:5: error: cannot access private member `SOME_PRIVATE_CONSTANT` of type `A`
- // CHECK:STDERR: A.SOME_PRIVATE_CONSTANT;
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE-14]]:15: note: declared here
- // CHECK:STDERR: private let SOME_PRIVATE_CONSTANT: i32 = 5;
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- A.SOME_PRIVATE_CONSTANT;
- // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE+7]]:12: error: cannot access protected member `SOME_PROTECTED_CONSTANT` of type `A`
- // CHECK:STDERR: return A.SOME_PROTECTED_CONSTANT;
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE-24]]:17: note: declared here
- // CHECK:STDERR: protected let SOME_PROTECTED_CONSTANT: i32 = 5;
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- return A.SOME_PROTECTED_CONSTANT;
- }
- fn SomeFunc[self: Self]() -> i32{
- // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE+7]]:12: error: cannot access protected member `INTERNAL_CONSTANT` of type `Internal`
- // CHECK:STDERR: return self.internal.INTERNAL_CONSTANT;
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR: fail_non_inherited_access.carbon:[[@LINE-30]]:17: note: declared here
- // CHECK:STDERR: protected let INTERNAL_CONSTANT: i32 = 5;
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- return self.internal.INTERNAL_CONSTANT;
- }
- }
- // --- fail_compound_member_access.carbon
- library "[[@TEST_NAME]]";
- base class A {
- private var x: i32;
- }
- class B {
- extend base: A;
- fn F[self: Self]() {
- // CHECK:STDERR: fail_compound_member_access.carbon:[[@LINE+6]]:11: error: cannot access private member `x` of type `A`
- // CHECK:STDERR: self.(A.x);
- // CHECK:STDERR: ^~~
- // CHECK:STDERR: fail_compound_member_access.carbon:[[@LINE-9]]:15: note: declared here
- // CHECK:STDERR: private var x: i32;
- // CHECK:STDERR: ^~~~~~
- self.(A.x);
- }
- }
- // --- inherited_compound_member_access.carbon
- library "[[@TEST_NAME]]";
- base class A {
- protected var x: i32;
- }
- class B {
- extend base: A;
- fn F[self: Self]() {
- self.(A.x);
- }
- }
- // CHECK:STDOUT: --- instance_protected_field_access.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %Shape: type = class_type @Shape [template]
- // 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: %.2: type = unbound_element_type %Shape, i32 [template]
- // CHECK:STDOUT: %.3: type = struct_type {.x: i32, .y: i32} [template]
- // CHECK:STDOUT: %.4: <witness> = complete_type_witness %.3 [template]
- // CHECK:STDOUT: %Circle: type = class_type @Circle [template]
- // CHECK:STDOUT: %.5: type = ptr_type %.3 [template]
- // CHECK:STDOUT: %.6: type = unbound_element_type %Circle, %Shape [template]
- // CHECK:STDOUT: %.7: type = tuple_type (type, type) [template]
- // CHECK:STDOUT: %.8: type = tuple_type (i32, i32) [template]
- // CHECK:STDOUT: %GetPosition.type: type = fn_type @GetPosition [template]
- // CHECK:STDOUT: %GetPosition: %GetPosition.type = struct_value () [template]
- // CHECK:STDOUT: %.9: type = struct_type {.base: %Shape} [template]
- // CHECK:STDOUT: %.10: <witness> = complete_type_witness %.9 [template]
- // CHECK:STDOUT: %.11: type = ptr_type %.8 [template]
- // CHECK:STDOUT: %.12: type = struct_type {.base: %.5} [template]
- // CHECK:STDOUT: %.13: type = ptr_type %.9 [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: .Shape = %Shape.decl
- // CHECK:STDOUT: .Circle = %Circle.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %Shape.decl: type = class_decl @Shape [template = constants.%Shape] {} {}
- // CHECK:STDOUT: %Circle.decl: type = class_decl @Circle [template = constants.%Circle] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @Shape {
- // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc5_20.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32]
- // CHECK:STDOUT: %.loc5_20.2: type = converted %int.make_type_32.loc5, %.loc5_20.1 [template = i32]
- // CHECK:STDOUT: %.loc5_18: %.2 = field_decl x, element0 [template]
- // CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc6_20.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32]
- // CHECK:STDOUT: %.loc6_20.2: type = converted %int.make_type_32.loc6, %.loc6_20.1 [template = i32]
- // CHECK:STDOUT: %.loc6_18: %.2 = field_decl y, element1 [template]
- // CHECK:STDOUT: %.loc7: <witness> = complete_type_witness %.3 [template = constants.%.4]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%Shape
- // CHECK:STDOUT: .x [protected] = %.loc5_18
- // CHECK:STDOUT: .y [protected] = %.loc6_18
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @Circle {
- // CHECK:STDOUT: %Shape.ref: type = name_ref Shape, file.%Shape.decl [template = constants.%Shape]
- // CHECK:STDOUT: %.loc10: %.6 = base_decl %Shape, element0 [template]
- // CHECK:STDOUT: %GetPosition.decl: %GetPosition.type = fn_decl @GetPosition [template = constants.%GetPosition] {
- // CHECK:STDOUT: %self.patt: %Circle = binding_pattern self
- // CHECK:STDOUT: %self.param_patt: %Circle = param_pattern %self.patt, runtime_param0
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Circle [template = constants.%Circle]
- // CHECK:STDOUT: %int.make_type_32.loc12_36: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %int.make_type_32.loc12_41: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc12_44.1: %.7 = tuple_literal (%int.make_type_32.loc12_36, %int.make_type_32.loc12_41)
- // CHECK:STDOUT: %.loc12_44.2: type = value_of_initializer %int.make_type_32.loc12_36 [template = i32]
- // CHECK:STDOUT: %.loc12_44.3: type = converted %int.make_type_32.loc12_36, %.loc12_44.2 [template = i32]
- // CHECK:STDOUT: %.loc12_44.4: type = value_of_initializer %int.make_type_32.loc12_41 [template = i32]
- // CHECK:STDOUT: %.loc12_44.5: type = converted %int.make_type_32.loc12_41, %.loc12_44.4 [template = i32]
- // CHECK:STDOUT: %.loc12_44.6: type = converted %.loc12_44.1, constants.%.8 [template = constants.%.8]
- // CHECK:STDOUT: %return: ref %.8 = var <return slot>
- // CHECK:STDOUT: %param: %Circle = param runtime_param0
- // CHECK:STDOUT: %self: %Circle = bind_name self, %param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %.loc15: <witness> = complete_type_witness %.9 [template = constants.%.10]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%Circle
- // CHECK:STDOUT: .base = %.loc10
- // CHECK:STDOUT: .GetPosition = %GetPosition.decl
- // CHECK:STDOUT: extend name_scope2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @GetPosition[%self.param_patt: %Circle]() -> %return: %.8 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %self.ref.loc13_13: %Circle = name_ref self, %self
- // CHECK:STDOUT: %x.ref: %.2 = name_ref x, @Shape.%.loc5_18 [template = @Shape.%.loc5_18]
- // CHECK:STDOUT: %.loc13_17.1: ref %Shape = class_element_access %self.ref.loc13_13, element0
- // CHECK:STDOUT: %.loc13_17.2: ref %Shape = converted %self.ref.loc13_13, %.loc13_17.1
- // CHECK:STDOUT: %.loc13_17.3: ref i32 = class_element_access %.loc13_17.2, element0
- // CHECK:STDOUT: %self.ref.loc13_21: %Circle = name_ref self, %self
- // CHECK:STDOUT: %y.ref: %.2 = name_ref y, @Shape.%.loc6_18 [template = @Shape.%.loc6_18]
- // CHECK:STDOUT: %.loc13_25.1: ref %Shape = class_element_access %self.ref.loc13_21, element0
- // CHECK:STDOUT: %.loc13_25.2: ref %Shape = converted %self.ref.loc13_21, %.loc13_25.1
- // CHECK:STDOUT: %.loc13_25.3: ref i32 = class_element_access %.loc13_25.2, element1
- // CHECK:STDOUT: %.loc13_27.1: %.8 = tuple_literal (%.loc13_17.3, %.loc13_25.3)
- // CHECK:STDOUT: %.loc13_17.4: i32 = bind_value %.loc13_17.3
- // CHECK:STDOUT: %.loc13_27.2: ref i32 = tuple_access %return, element0
- // CHECK:STDOUT: %.loc13_27.3: init i32 = initialize_from %.loc13_17.4 to %.loc13_27.2
- // CHECK:STDOUT: %.loc13_25.4: i32 = bind_value %.loc13_25.3
- // CHECK:STDOUT: %.loc13_27.4: ref i32 = tuple_access %return, element1
- // CHECK:STDOUT: %.loc13_27.5: init i32 = initialize_from %.loc13_25.4 to %.loc13_27.4
- // CHECK:STDOUT: %.loc13_27.6: init %.8 = tuple_init (%.loc13_27.3, %.loc13_27.5) to %return
- // CHECK:STDOUT: %.loc13_28: init %.8 = converted %.loc13_27.1, %.loc13_27.6
- // CHECK:STDOUT: return %.loc13_28 to %return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- shadowing_access.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %A: type = class_type @A [template]
- // CHECK:STDOUT: %F.type.1: type = fn_type @F.1 [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %F.1: %F.type.1 = struct_value () [template]
- // CHECK:STDOUT: %.2: type = struct_type {} [template]
- // CHECK:STDOUT: %.3: <witness> = complete_type_witness %.2 [template]
- // CHECK:STDOUT: %B: type = class_type @B [template]
- // CHECK:STDOUT: %.4: type = ptr_type %.2 [template]
- // CHECK:STDOUT: %.5: type = unbound_element_type %B, %A [template]
- // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
- // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
- // CHECK:STDOUT: %F.type.2: type = fn_type @F.2 [template]
- // CHECK:STDOUT: %F.2: %F.type.2 = struct_value () [template]
- // CHECK:STDOUT: %.6: type = struct_type {.base: %A} [template]
- // CHECK:STDOUT: %.7: <witness> = complete_type_witness %.6 [template]
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %.8: type = struct_type {.base: %.4} [template]
- // CHECK:STDOUT: %.9: type = ptr_type %.6 [template]
- // CHECK:STDOUT: %.10: type = unbound_element_type %C, %B [template]
- // CHECK:STDOUT: %G.type: type = fn_type @G [template]
- // CHECK:STDOUT: %G: %G.type = struct_value () [template]
- // CHECK:STDOUT: %.11: type = struct_type {.base: %B} [template]
- // CHECK:STDOUT: %.12: <witness> = complete_type_witness %.11 [template]
- // CHECK:STDOUT: %.13: type = struct_type {.base: %.9} [template]
- // CHECK:STDOUT: %.14: type = ptr_type %.11 [template]
- // CHECK:STDOUT: %tuple: %.1 = tuple_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: .A = %A.decl
- // CHECK:STDOUT: .B = %B.decl
- // CHECK:STDOUT: .C = %C.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} {}
- // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} {}
- // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @A {
- // CHECK:STDOUT: %F.decl: %F.type.1 = fn_decl @F.1 [template = constants.%F.1] {} {}
- // CHECK:STDOUT: %.loc6: <witness> = complete_type_witness %.2 [template = constants.%.3]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%A
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @B {
- // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
- // CHECK:STDOUT: %.loc9: %.5 = base_decl %A, element0 [template]
- // CHECK:STDOUT: %F.decl: %F.type.2 = fn_decl @F.2 [template = constants.%F.2] {} {
- // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc10_21.1: type = value_of_initializer %int.make_type_32 [template = i32]
- // CHECK:STDOUT: %.loc10_21.2: type = converted %int.make_type_32, %.loc10_21.1 [template = i32]
- // CHECK:STDOUT: %return: ref i32 = var <return slot>
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %.loc11: <witness> = complete_type_witness %.6 [template = constants.%.7]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%B
- // CHECK:STDOUT: .base = %.loc9
- // CHECK:STDOUT: .F [private] = %F.decl
- // CHECK:STDOUT: extend name_scope2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C {
- // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B]
- // CHECK:STDOUT: %.loc14: %.10 = base_decl %B, element0 [template]
- // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
- // CHECK:STDOUT: %self.patt: %C = binding_pattern self
- // CHECK:STDOUT: %self.param_patt: %C = param_pattern %self.patt, runtime_param0
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C]
- // CHECK:STDOUT: %.loc15_26.1: %.1 = tuple_literal ()
- // CHECK:STDOUT: %.loc15_26.2: type = converted %.loc15_26.1, constants.%.1 [template = constants.%.1]
- // CHECK:STDOUT: %return: ref %.1 = var <return slot>
- // CHECK:STDOUT: %param: %C = param runtime_param0
- // CHECK:STDOUT: %self: %C = bind_name self, %param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %.loc16: <witness> = complete_type_witness %.11 [template = constants.%.12]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%C
- // CHECK:STDOUT: .base = %.loc14
- // CHECK:STDOUT: .G = %G.decl
- // CHECK:STDOUT: extend name_scope3
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F.1();
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F.2() -> i32;
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G[%self.param_patt: %C]() -> %.1 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %self.ref: %C = name_ref self, %self
- // CHECK:STDOUT: %F.ref: %F.type.1 = name_ref F, @A.%F.decl [template = constants.%F.1]
- // CHECK:STDOUT: %F.call: init %.1 = call %F.ref()
- // CHECK:STDOUT: %.loc15_43.1: ref %.1 = temporary_storage
- // CHECK:STDOUT: %.loc15_43.2: ref %.1 = temporary %.loc15_43.1, %F.call
- // CHECK:STDOUT: %tuple: %.1 = tuple_value () [template = constants.%tuple]
- // CHECK:STDOUT: %.loc15_45: %.1 = converted %F.call, %tuple [template = constants.%tuple]
- // CHECK:STDOUT: return %.loc15_45
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- inherited_member_access.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %A: type = class_type @A [template]
- // 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: %.2: i32 = int_literal 5 [template]
- // CHECK:STDOUT: %SomeProtectedFunction.type: type = fn_type @SomeProtectedFunction [template]
- // CHECK:STDOUT: %SomeProtectedFunction: %SomeProtectedFunction.type = struct_value () [template]
- // CHECK:STDOUT: %.3: type = struct_type {} [template]
- // CHECK:STDOUT: %.4: <witness> = complete_type_witness %.3 [template]
- // CHECK:STDOUT: %B: type = class_type @B [template]
- // CHECK:STDOUT: %.5: type = ptr_type %.3 [template]
- // CHECK:STDOUT: %.6: type = unbound_element_type %B, %A [template]
- // CHECK:STDOUT: %G.type: type = fn_type @G [template]
- // CHECK:STDOUT: %G: %G.type = struct_value () [template]
- // CHECK:STDOUT: %H.type: type = fn_type @H [template]
- // CHECK:STDOUT: %H: %H.type = struct_value () [template]
- // CHECK:STDOUT: %.7: type = struct_type {.base: %A} [template]
- // CHECK:STDOUT: %.8: <witness> = complete_type_witness %.7 [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: .A = %A.decl
- // CHECK:STDOUT: .B = %B.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} {}
- // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @A {
- // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc5_32.1: type = value_of_initializer %int.make_type_32 [template = i32]
- // CHECK:STDOUT: %.loc5_32.2: type = converted %int.make_type_32, %.loc5_32.1 [template = i32]
- // CHECK:STDOUT: %.loc5_38: i32 = int_literal 5 [template = constants.%.2]
- // CHECK:STDOUT: %SOME_CONSTANT: i32 = bind_name SOME_CONSTANT, %.loc5_38
- // CHECK:STDOUT: %SomeProtectedFunction.decl: %SomeProtectedFunction.type = fn_decl @SomeProtectedFunction [template = constants.%SomeProtectedFunction] {} {
- // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc6_43.1: type = value_of_initializer %int.make_type_32 [template = i32]
- // CHECK:STDOUT: %.loc6_43.2: type = converted %int.make_type_32, %.loc6_43.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.%A
- // CHECK:STDOUT: .SOME_CONSTANT [protected] = %SOME_CONSTANT
- // CHECK:STDOUT: .SomeProtectedFunction [protected] = %SomeProtectedFunction.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @B {
- // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
- // CHECK:STDOUT: %.loc12: %.6 = base_decl %A, element0 [template]
- // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {} {
- // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc14_13.1: type = value_of_initializer %int.make_type_32 [template = i32]
- // CHECK:STDOUT: %.loc14_13.2: type = converted %int.make_type_32, %.loc14_13.1 [template = i32]
- // CHECK:STDOUT: %return: ref i32 = var <return slot>
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [template = constants.%H] {} {
- // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc18_13.1: type = value_of_initializer %int.make_type_32 [template = i32]
- // CHECK:STDOUT: %.loc18_13.2: type = converted %int.make_type_32, %.loc18_13.1 [template = i32]
- // CHECK:STDOUT: %return: ref i32 = var <return slot>
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %.loc21: <witness> = complete_type_witness %.7 [template = constants.%.8]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%B
- // CHECK:STDOUT: .base = %.loc12
- // CHECK:STDOUT: .G = %G.decl
- // CHECK:STDOUT: .H = %H.decl
- // CHECK:STDOUT: extend name_scope2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @SomeProtectedFunction() -> i32 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %.loc7: i32 = int_literal 5 [template = constants.%.2]
- // CHECK:STDOUT: return %.loc7
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G() -> i32 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
- // CHECK:STDOUT: %SOME_CONSTANT.ref: i32 = name_ref SOME_CONSTANT, @A.%SOME_CONSTANT
- // CHECK:STDOUT: return %SOME_CONSTANT.ref
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @H() -> i32 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
- // CHECK:STDOUT: %SomeProtectedFunction.ref: %SomeProtectedFunction.type = name_ref SomeProtectedFunction, @A.%SomeProtectedFunction.decl [template = constants.%SomeProtectedFunction]
- // CHECK:STDOUT: %SomeProtectedFunction.call: init i32 = call %SomeProtectedFunction.ref()
- // CHECK:STDOUT: %.loc19_37.1: i32 = value_of_initializer %SomeProtectedFunction.call
- // CHECK:STDOUT: %.loc19_37.2: i32 = converted %SomeProtectedFunction.call, %.loc19_37.1
- // CHECK:STDOUT: return %.loc19_37.2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_inherited_private_field_access.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %Shape: type = class_type @Shape [template]
- // 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: %.2: type = unbound_element_type %Shape, i32 [template]
- // CHECK:STDOUT: %.3: type = struct_type {.y: i32} [template]
- // CHECK:STDOUT: %.4: <witness> = complete_type_witness %.3 [template]
- // CHECK:STDOUT: %Square: type = class_type @Square [template]
- // CHECK:STDOUT: %.5: type = ptr_type %.3 [template]
- // CHECK:STDOUT: %.6: type = unbound_element_type %Square, %Shape [template]
- // CHECK:STDOUT: %GetPosition.type: type = fn_type @GetPosition [template]
- // CHECK:STDOUT: %GetPosition: %GetPosition.type = struct_value () [template]
- // CHECK:STDOUT: %.7: type = struct_type {.base: %Shape} [template]
- // CHECK:STDOUT: %.8: <witness> = complete_type_witness %.7 [template]
- // CHECK:STDOUT: %.9: type = struct_type {.base: %.5} [template]
- // CHECK:STDOUT: %.10: type = ptr_type %.7 [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: .Shape = %Shape.decl
- // CHECK:STDOUT: .Square = %Square.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %Shape.decl: type = class_decl @Shape [template = constants.%Shape] {} {}
- // CHECK:STDOUT: %Square.decl: type = class_decl @Square [template = constants.%Square] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @Shape {
- // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc5_18.1: type = value_of_initializer %int.make_type_32 [template = i32]
- // CHECK:STDOUT: %.loc5_18.2: type = converted %int.make_type_32, %.loc5_18.1 [template = i32]
- // CHECK:STDOUT: %.loc5_16: %.2 = field_decl y, element0 [template]
- // CHECK:STDOUT: %.loc6: <witness> = complete_type_witness %.3 [template = constants.%.4]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%Shape
- // CHECK:STDOUT: .y [private] = %.loc5_16
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @Square {
- // CHECK:STDOUT: %Shape.ref: type = name_ref Shape, file.%Shape.decl [template = constants.%Shape]
- // CHECK:STDOUT: %.loc9: %.6 = base_decl %Shape, element0 [template]
- // CHECK:STDOUT: %GetPosition.decl: %GetPosition.type = fn_decl @GetPosition [template = constants.%GetPosition] {
- // CHECK:STDOUT: %self.patt: %Square = binding_pattern self
- // CHECK:STDOUT: %self.param_patt: %Square = param_pattern %self.patt, runtime_param0
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Square [template = constants.%Square]
- // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc11_35.1: type = value_of_initializer %int.make_type_32 [template = i32]
- // CHECK:STDOUT: %.loc11_35.2: type = converted %int.make_type_32, %.loc11_35.1 [template = i32]
- // CHECK:STDOUT: %return: ref i32 = var <return slot>
- // CHECK:STDOUT: %param: %Square = param runtime_param0
- // CHECK:STDOUT: %self: %Square = bind_name self, %param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %.loc21: <witness> = complete_type_witness %.7 [template = constants.%.8]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%Square
- // CHECK:STDOUT: .base = %.loc9
- // CHECK:STDOUT: .GetPosition = %GetPosition.decl
- // CHECK:STDOUT: extend name_scope2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @GetPosition[%self.param_patt: %Square]() -> i32 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %self.ref: %Square = name_ref self, %self
- // CHECK:STDOUT: %y.ref: <error> = name_ref y, <error> [template = <error>]
- // CHECK:STDOUT: return <error>
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- noninstance_private_on_self.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: %G.type: type = fn_type @G [template]
- // CHECK:STDOUT: %G: %G.type = struct_value () [template]
- // CHECK:STDOUT: %.2: type = struct_type {} [template]
- // CHECK:STDOUT: %.3: <witness> = complete_type_witness %.2 [template]
- // CHECK:STDOUT: %.4: type = ptr_type %.2 [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // 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: .Core = imports.%Core
- // CHECK:STDOUT: .C = %C.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C {
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
- // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {} {}
- // CHECK:STDOUT: %.loc7: <witness> = complete_type_witness %.2 [template = constants.%.3]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%C
- // CHECK:STDOUT: .F [private] = %F.decl
- // CHECK:STDOUT: .G = %G.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C]
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, @C.%F.decl [template = constants.%F]
- // CHECK:STDOUT: %F.call: init %.1 = call %F.ref()
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- noninstance_protected_on_self.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: %G.type: type = fn_type @G [template]
- // CHECK:STDOUT: %G: %G.type = struct_value () [template]
- // CHECK:STDOUT: %.2: type = struct_type {} [template]
- // CHECK:STDOUT: %.3: <witness> = complete_type_witness %.2 [template]
- // CHECK:STDOUT: %.4: type = ptr_type %.2 [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // 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: .Core = imports.%Core
- // CHECK:STDOUT: .C = %C.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C {
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
- // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {} {}
- // CHECK:STDOUT: %.loc7: <witness> = complete_type_witness %.2 [template = constants.%.3]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%C
- // CHECK:STDOUT: .F [protected] = %F.decl
- // CHECK:STDOUT: .G = %G.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C]
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, @C.%F.decl [template = constants.%F]
- // CHECK:STDOUT: %F.call: init %.1 = call %F.ref()
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_noninstance_private_on_parent.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %B: type = class_type @B [template]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: %.2: type = struct_type {} [template]
- // CHECK:STDOUT: %.3: <witness> = complete_type_witness %.2 [template]
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %.4: type = ptr_type %.2 [template]
- // CHECK:STDOUT: %.5: type = unbound_element_type %C, %B [template]
- // CHECK:STDOUT: %G.type: type = fn_type @G [template]
- // CHECK:STDOUT: %G: %G.type = struct_value () [template]
- // CHECK:STDOUT: %.6: type = struct_type {.base: %B} [template]
- // CHECK:STDOUT: %.7: <witness> = complete_type_witness %.6 [template]
- // CHECK:STDOUT: %.8: type = struct_type {.base: %.4} [template]
- // CHECK:STDOUT: %.9: type = ptr_type %.6 [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // 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: .Core = imports.%Core
- // CHECK:STDOUT: .B = %B.decl
- // CHECK:STDOUT: .C = %C.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} {}
- // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @B {
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
- // CHECK:STDOUT: %.loc6: <witness> = complete_type_witness %.2 [template = constants.%.3]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%B
- // CHECK:STDOUT: .F [private] = %F.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C {
- // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B]
- // CHECK:STDOUT: %.loc9: %.5 = base_decl %B, element0 [template]
- // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {} {}
- // CHECK:STDOUT: %.loc18: <witness> = complete_type_witness %.6 [template = constants.%.7]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%C
- // CHECK:STDOUT: .base = %.loc9
- // CHECK:STDOUT: .G = %G.decl
- // CHECK:STDOUT: extend name_scope2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C]
- // CHECK:STDOUT: %F.ref: <error> = name_ref F, <error> [template = <error>]
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- noninstance_protected_on_parent.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %B: type = class_type @B [template]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %.1: type = tuple_type () [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: %.2: type = struct_type {} [template]
- // CHECK:STDOUT: %.3: <witness> = complete_type_witness %.2 [template]
- // CHECK:STDOUT: %C: type = class_type @C [template]
- // CHECK:STDOUT: %.4: type = ptr_type %.2 [template]
- // CHECK:STDOUT: %.5: type = unbound_element_type %C, %B [template]
- // CHECK:STDOUT: %G.type: type = fn_type @G [template]
- // CHECK:STDOUT: %G: %G.type = struct_value () [template]
- // CHECK:STDOUT: %.6: type = struct_type {.base: %B} [template]
- // CHECK:STDOUT: %.7: <witness> = complete_type_witness %.6 [template]
- // CHECK:STDOUT: %.8: type = struct_type {.base: %.4} [template]
- // CHECK:STDOUT: %.9: type = ptr_type %.6 [template]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // 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: .Core = imports.%Core
- // CHECK:STDOUT: .B = %B.decl
- // CHECK:STDOUT: .C = %C.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} {}
- // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @B {
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
- // CHECK:STDOUT: %.loc6: <witness> = complete_type_witness %.2 [template = constants.%.3]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%B
- // CHECK:STDOUT: .F [protected] = %F.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C {
- // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B]
- // CHECK:STDOUT: %.loc9: %.5 = base_decl %B, element0 [template]
- // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {} {}
- // CHECK:STDOUT: %.loc11: <witness> = complete_type_witness %.6 [template = constants.%.7]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%C
- // CHECK:STDOUT: .base = %.loc9
- // CHECK:STDOUT: .G = %G.decl
- // CHECK:STDOUT: extend name_scope2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C]
- // CHECK:STDOUT: %F.ref: %F.type = name_ref F, @B.%F.decl [template = constants.%F]
- // CHECK:STDOUT: %F.call: init %.1 = call %F.ref()
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_non_inherited_access.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %A: type = class_type @A [template]
- // 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: %.2: i32 = int_literal 5 [template]
- // CHECK:STDOUT: %.3: type = struct_type {} [template]
- // CHECK:STDOUT: %.4: <witness> = complete_type_witness %.3 [template]
- // CHECK:STDOUT: %Internal: type = class_type @Internal [template]
- // CHECK:STDOUT: %B: type = class_type @B [template]
- // CHECK:STDOUT: %.5: type = ptr_type %.3 [template]
- // CHECK:STDOUT: %.6: type = unbound_element_type %B, %Internal [template]
- // CHECK:STDOUT: %G.type: type = fn_type @G [template]
- // CHECK:STDOUT: %G: %G.type = struct_value () [template]
- // CHECK:STDOUT: %SomeFunc.type: type = fn_type @SomeFunc [template]
- // CHECK:STDOUT: %SomeFunc: %SomeFunc.type = struct_value () [template]
- // CHECK:STDOUT: %.7: type = struct_type {.internal: %Internal} [template]
- // CHECK:STDOUT: %.8: <witness> = complete_type_witness %.7 [template]
- // CHECK:STDOUT: %.9: type = struct_type {.internal: %.5} [template]
- // CHECK:STDOUT: %.10: type = ptr_type %.7 [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: .A = %A.decl
- // CHECK:STDOUT: .Internal = %Internal.decl
- // CHECK:STDOUT: .B = %B.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} {}
- // CHECK:STDOUT: %Internal.decl: type = class_decl @Internal [template = constants.%Internal] {} {}
- // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @A {
- // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc5_42.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32]
- // CHECK:STDOUT: %.loc5_42.2: type = converted %int.make_type_32.loc5, %.loc5_42.1 [template = i32]
- // CHECK:STDOUT: %.loc5_48: i32 = int_literal 5 [template = constants.%.2]
- // CHECK:STDOUT: %SOME_PROTECTED_CONSTANT: i32 = bind_name SOME_PROTECTED_CONSTANT, %.loc5_48
- // CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc6_38.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32]
- // CHECK:STDOUT: %.loc6_38.2: type = converted %int.make_type_32.loc6, %.loc6_38.1 [template = i32]
- // CHECK:STDOUT: %.loc6_44: i32 = int_literal 5 [template = constants.%.2]
- // CHECK:STDOUT: %SOME_PRIVATE_CONSTANT: i32 = bind_name SOME_PRIVATE_CONSTANT, %.loc6_44
- // CHECK:STDOUT: %.loc7: <witness> = complete_type_witness %.3 [template = constants.%.4]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%A
- // CHECK:STDOUT: .SOME_PROTECTED_CONSTANT [protected] = %SOME_PROTECTED_CONSTANT
- // CHECK:STDOUT: .SOME_PRIVATE_CONSTANT [private] = %SOME_PRIVATE_CONSTANT
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @Internal {
- // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc10_36.1: type = value_of_initializer %int.make_type_32 [template = i32]
- // CHECK:STDOUT: %.loc10_36.2: type = converted %int.make_type_32, %.loc10_36.1 [template = i32]
- // CHECK:STDOUT: %.loc10_42: i32 = int_literal 5 [template = constants.%.2]
- // CHECK:STDOUT: %INTERNAL_CONSTANT: i32 = bind_name INTERNAL_CONSTANT, %.loc10_42
- // CHECK:STDOUT: %.loc11: <witness> = complete_type_witness %.3 [template = constants.%.4]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%Internal
- // CHECK:STDOUT: .INTERNAL_CONSTANT [protected] = %INTERNAL_CONSTANT
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @B {
- // CHECK:STDOUT: %Internal.ref: type = name_ref Internal, file.%Internal.decl [template = constants.%Internal]
- // CHECK:STDOUT: %.loc14: %.6 = field_decl internal, element0 [template]
- // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {} {
- // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc16_13.1: type = value_of_initializer %int.make_type_32 [template = i32]
- // CHECK:STDOUT: %.loc16_13.2: type = converted %int.make_type_32, %.loc16_13.1 [template = i32]
- // CHECK:STDOUT: %return: ref i32 = var <return slot>
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %SomeFunc.decl: %SomeFunc.type = fn_decl @SomeFunc [template = constants.%SomeFunc] {
- // CHECK:STDOUT: %self.patt: %B = binding_pattern self
- // CHECK:STDOUT: %self.param_patt: %B = param_pattern %self.patt, runtime_param0
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%B [template = constants.%B]
- // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc36_32.1: type = value_of_initializer %int.make_type_32 [template = i32]
- // CHECK:STDOUT: %.loc36_32.2: type = converted %int.make_type_32, %.loc36_32.1 [template = i32]
- // CHECK:STDOUT: %return: ref i32 = var <return slot>
- // CHECK:STDOUT: %param: %B = param runtime_param0
- // CHECK:STDOUT: %self: %B = bind_name self, %param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %.loc46: <witness> = complete_type_witness %.7 [template = constants.%.8]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%B
- // CHECK:STDOUT: .internal [private] = %.loc14
- // CHECK:STDOUT: .G = %G.decl
- // CHECK:STDOUT: .SomeFunc = %SomeFunc.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G() -> i32 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %A.ref.loc24: type = name_ref A, file.%A.decl [template = constants.%A]
- // CHECK:STDOUT: %SOME_PRIVATE_CONSTANT.ref: <error> = name_ref SOME_PRIVATE_CONSTANT, <error> [template = <error>]
- // CHECK:STDOUT: %A.ref.loc33: type = name_ref A, file.%A.decl [template = constants.%A]
- // CHECK:STDOUT: %SOME_PROTECTED_CONSTANT.ref: <error> = name_ref SOME_PROTECTED_CONSTANT, <error> [template = <error>]
- // CHECK:STDOUT: return <error>
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @SomeFunc[%self.param_patt: %B]() -> i32 {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %self.ref: %B = name_ref self, %self
- // CHECK:STDOUT: %internal.ref: %.6 = name_ref internal, @B.%.loc14 [template = @B.%.loc14]
- // CHECK:STDOUT: %.loc44_16.1: ref %Internal = class_element_access %self.ref, element0
- // CHECK:STDOUT: %.loc44_16.2: %Internal = bind_value %.loc44_16.1
- // CHECK:STDOUT: %INTERNAL_CONSTANT.ref: <error> = name_ref INTERNAL_CONSTANT, <error> [template = <error>]
- // CHECK:STDOUT: return <error>
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_compound_member_access.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %A: type = class_type @A [template]
- // 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: %.2: type = unbound_element_type %A, i32 [template]
- // CHECK:STDOUT: %.3: type = struct_type {.x: i32} [template]
- // CHECK:STDOUT: %.4: <witness> = complete_type_witness %.3 [template]
- // CHECK:STDOUT: %B: type = class_type @B [template]
- // CHECK:STDOUT: %.5: type = ptr_type %.3 [template]
- // CHECK:STDOUT: %.6: type = unbound_element_type %B, %A [template]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: %.7: type = struct_type {.base: %A} [template]
- // CHECK:STDOUT: %.8: <witness> = complete_type_witness %.7 [template]
- // CHECK:STDOUT: %.9: type = struct_type {.base: %.5} [template]
- // CHECK:STDOUT: %.10: type = ptr_type %.7 [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: .A = %A.decl
- // CHECK:STDOUT: .B = %B.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} {}
- // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @A {
- // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc5_18.1: type = value_of_initializer %int.make_type_32 [template = i32]
- // CHECK:STDOUT: %.loc5_18.2: type = converted %int.make_type_32, %.loc5_18.1 [template = i32]
- // CHECK:STDOUT: %.loc5_16: %.2 = field_decl x, element0 [template]
- // CHECK:STDOUT: %.loc6: <witness> = complete_type_witness %.3 [template = constants.%.4]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%A
- // CHECK:STDOUT: .x [private] = %.loc5_16
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @B {
- // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
- // CHECK:STDOUT: %.loc9: %.6 = base_decl %A, element0 [template]
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
- // CHECK:STDOUT: %self.patt: %B = binding_pattern self
- // CHECK:STDOUT: %self.param_patt: %B = param_pattern %self.patt, runtime_param0
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%B [template = constants.%B]
- // CHECK:STDOUT: %param: %B = param runtime_param0
- // CHECK:STDOUT: %self: %B = bind_name self, %param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %.loc19: <witness> = complete_type_witness %.7 [template = constants.%.8]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%B
- // CHECK:STDOUT: .base = %.loc9
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: extend name_scope2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F[%self.param_patt: %B]() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %self.ref: %B = name_ref self, %self
- // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
- // CHECK:STDOUT: %x.ref: <error> = name_ref x, <error> [template = <error>]
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- inherited_compound_member_access.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %A: type = class_type @A [template]
- // 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: %.2: type = unbound_element_type %A, i32 [template]
- // CHECK:STDOUT: %.3: type = struct_type {.x: i32} [template]
- // CHECK:STDOUT: %.4: <witness> = complete_type_witness %.3 [template]
- // CHECK:STDOUT: %B: type = class_type @B [template]
- // CHECK:STDOUT: %.5: type = ptr_type %.3 [template]
- // CHECK:STDOUT: %.6: type = unbound_element_type %B, %A [template]
- // CHECK:STDOUT: %F.type: type = fn_type @F [template]
- // CHECK:STDOUT: %F: %F.type = struct_value () [template]
- // CHECK:STDOUT: %.7: type = struct_type {.base: %A} [template]
- // CHECK:STDOUT: %.8: <witness> = complete_type_witness %.7 [template]
- // CHECK:STDOUT: %.9: type = struct_type {.base: %.5} [template]
- // CHECK:STDOUT: %.10: type = ptr_type %.7 [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: .A = %A.decl
- // CHECK:STDOUT: .B = %B.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} {}
- // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @A {
- // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
- // CHECK:STDOUT: %.loc5_20.1: type = value_of_initializer %int.make_type_32 [template = i32]
- // CHECK:STDOUT: %.loc5_20.2: type = converted %int.make_type_32, %.loc5_20.1 [template = i32]
- // CHECK:STDOUT: %.loc5_18: %.2 = field_decl x, element0 [template]
- // CHECK:STDOUT: %.loc6: <witness> = complete_type_witness %.3 [template = constants.%.4]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%A
- // CHECK:STDOUT: .x [protected] = %.loc5_18
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @B {
- // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
- // CHECK:STDOUT: %.loc9: %.6 = base_decl %A, element0 [template]
- // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
- // CHECK:STDOUT: %self.patt: %B = binding_pattern self
- // CHECK:STDOUT: %self.param_patt: %B = param_pattern %self.patt, runtime_param0
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%B [template = constants.%B]
- // CHECK:STDOUT: %param: %B = param runtime_param0
- // CHECK:STDOUT: %self: %B = bind_name self, %param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %.loc14: <witness> = complete_type_witness %.7 [template = constants.%.8]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%B
- // CHECK:STDOUT: .base = %.loc9
- // CHECK:STDOUT: .F = %F.decl
- // CHECK:STDOUT: extend name_scope2
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F[%self.param_patt: %B]() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %self.ref: %B = name_ref self, %self
- // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A]
- // CHECK:STDOUT: %x.ref: %.2 = name_ref x, @A.%.loc5_18 [template = @A.%.loc5_18]
- // CHECK:STDOUT: %.loc12_9.1: ref %A = class_element_access %self.ref, element0
- // CHECK:STDOUT: %.loc12_9.2: ref %A = converted %self.ref, %.loc12_9.1
- // CHECK:STDOUT: %.loc12_9.3: ref i32 = class_element_access %.loc12_9.2, element0
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
|