| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
- // Exceptions. See /LICENSE for license information.
- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- //
- // AUTOUPDATE
- // TIP: To test this file alone, run:
- // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/fail_call_invalid.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_call_invalid.carbon
- interface Simple {
- fn G[self: Self]();
- }
- impl i32 as Simple {
- // CHECK:STDERR: fail_call_invalid.carbon:[[@LINE+4]]:14: error: name `Undeclared` not found [NameNotFound]
- // CHECK:STDERR: fn G[self: Undeclared]();
- // CHECK:STDERR: ^~~~~~~~~~
- // CHECK:STDERR:
- fn G[self: Undeclared]();
- }
- fn InstanceCall(n: i32) {
- n.(Simple.G)();
- }
- // CHECK:STDOUT: --- fail_call_invalid.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %Simple.type: type = facet_type <@Simple> [concrete]
- // CHECK:STDOUT: %Self.3c9: %Simple.type = bind_symbolic_name Self, 0 [symbolic]
- // CHECK:STDOUT: %Self.as_type.716: type = facet_access_type %Self.3c9 [symbolic]
- // CHECK:STDOUT: %G.type.b60: type = fn_type @G.1 [concrete]
- // CHECK:STDOUT: %G.cb0: %G.type.b60 = struct_value () [concrete]
- // CHECK:STDOUT: %Simple.assoc_type: type = assoc_entity_type %Simple.type [concrete]
- // CHECK:STDOUT: %assoc0.45f: %Simple.assoc_type = assoc_entity element0, @Simple.%G.decl [concrete]
- // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
- // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
- // CHECK:STDOUT: %impl_witness.85b: <witness> = impl_witness (<error>) [concrete]
- // CHECK:STDOUT: %G.type.c98: type = fn_type @G.2 [concrete]
- // CHECK:STDOUT: %G.e73: %G.type.c98 = struct_value () [concrete]
- // CHECK:STDOUT: %Simple.facet: %Simple.type = facet_value %i32, (%impl_witness.85b) [concrete]
- // CHECK:STDOUT: %InstanceCall.type: type = fn_type @InstanceCall [concrete]
- // CHECK:STDOUT: %InstanceCall: %InstanceCall.type = struct_value () [concrete]
- // CHECK:STDOUT: %.e92: type = fn_type_with_self_type %G.type.b60, %Simple.facet [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
- // CHECK:STDOUT: .Int = %Core.Int
- // CHECK:STDOUT: import Core//prelude
- // CHECK:STDOUT: import Core//prelude/...
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .Core = imports.%Core
- // CHECK:STDOUT: .Simple = %Simple.decl
- // CHECK:STDOUT: .Undeclared = <poisoned>
- // CHECK:STDOUT: .InstanceCall = %InstanceCall.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import = import Core
- // CHECK:STDOUT: %Simple.decl: type = interface_decl @Simple [concrete = constants.%Simple.type] {} {}
- // CHECK:STDOUT: impl_decl @impl.006 [concrete] {} {
- // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
- // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
- // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [concrete = constants.%Simple.type]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (<error>) [concrete = constants.%impl_witness.85b]
- // CHECK:STDOUT: %InstanceCall.decl: %InstanceCall.type = fn_decl @InstanceCall [concrete = constants.%InstanceCall] {
- // CHECK:STDOUT: %n.patt: %i32 = binding_pattern n
- // CHECK:STDOUT: %n.param_patt: %i32 = value_param_pattern %n.patt, call_param0
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %n.param: %i32 = value_param call_param0
- // CHECK:STDOUT: %.loc23: type = splice_block %i32 [concrete = constants.%i32] {
- // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
- // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %n: %i32 = bind_name n, %n.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: interface @Simple {
- // CHECK:STDOUT: %Self: %Simple.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.3c9]
- // CHECK:STDOUT: %G.decl: %G.type.b60 = fn_decl @G.1 [concrete = constants.%G.cb0] {
- // CHECK:STDOUT: %self.patt: @G.1.%Self.as_type.loc12_14.1 (%Self.as_type.716) = binding_pattern self
- // CHECK:STDOUT: %self.param_patt: @G.1.%Self.as_type.loc12_14.1 (%Self.as_type.716) = value_param_pattern %self.patt, call_param0
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %self.param: @G.1.%Self.as_type.loc12_14.1 (%Self.as_type.716) = value_param call_param0
- // CHECK:STDOUT: %.loc12_14.1: type = splice_block %.loc12_14.2 [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type.716)] {
- // CHECK:STDOUT: %Self.ref: %Simple.type = name_ref Self, @Simple.%Self [symbolic = %Self (constants.%Self.3c9)]
- // CHECK:STDOUT: %Self.as_type.loc12_14.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type.716)]
- // CHECK:STDOUT: %.loc12_14.2: type = converted %Self.ref, %Self.as_type.loc12_14.2 [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type.716)]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %self: @G.1.%Self.as_type.loc12_14.1 (%Self.as_type.716) = bind_name self, %self.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %assoc0: %Simple.assoc_type = assoc_entity element0, %G.decl [concrete = constants.%assoc0.45f]
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = %Self
- // CHECK:STDOUT: .G = %assoc0
- // CHECK:STDOUT: witness = (%G.decl)
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: impl @impl.006: %i32 as %Simple.ref {
- // CHECK:STDOUT: %G.decl: %G.type.c98 = fn_decl @G.2 [concrete = constants.%G.e73] {
- // CHECK:STDOUT: %self.patt: <error> = binding_pattern self
- // CHECK:STDOUT: %self.param_patt: <error> = value_param_pattern %self.patt, call_param0 [concrete = <error>]
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: %self.param: <error> = value_param call_param0
- // CHECK:STDOUT: %Undeclared.ref: <error> = name_ref Undeclared, <error> [concrete = <error>]
- // CHECK:STDOUT: %self: <error> = bind_name self, %self.param
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Undeclared = <poisoned>
- // CHECK:STDOUT: .G = %G.decl
- // CHECK:STDOUT: witness = file.%impl_witness
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic fn @G.1(@Simple.%Self: %Simple.type) {
- // CHECK:STDOUT: %Self: %Simple.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.3c9)]
- // CHECK:STDOUT: %Self.as_type.loc12_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type.716)]
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn[%self.param_patt: @G.1.%Self.as_type.loc12_14.1 (%Self.as_type.716)]();
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @G.2[%self.param_patt: <error>]();
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @InstanceCall(%n.param_patt: %i32) {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n
- // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [concrete = constants.%Simple.type]
- // CHECK:STDOUT: %G.ref: %Simple.assoc_type = name_ref G, @Simple.%assoc0 [concrete = constants.%assoc0.45f]
- // CHECK:STDOUT: %impl.elem0: %.e92 = impl_witness_access constants.%impl_witness.85b, element0 [concrete = <error>]
- // CHECK:STDOUT: return
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @G.1(constants.%Self.3c9) {
- // CHECK:STDOUT: %Self => constants.%Self.3c9
- // CHECK:STDOUT: %Self.as_type.loc12_14.1 => constants.%Self.as_type.716
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @G.1(constants.%Simple.facet) {
- // CHECK:STDOUT: %Self => constants.%Simple.facet
- // CHECK:STDOUT: %Self.as_type.loc12_14.1 => constants.%i32
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
|