| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- // 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
- //
- // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
- // EXTRA-ARGS: --no-prelude-import --dump-sem-ir-ranges=if-present
- //
- // AUTOUPDATE
- // TIP: To test this file alone, run:
- // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon
- interface I { let T:! type; }
- // CHECK:STDERR: fail_impl_bad_assoc_const.carbon:[[@LINE+7]]:1: error: associated constant T not given a value in impl of interface I [ImplAssociatedConstantNeedsValue]
- // CHECK:STDERR: impl () as I {}
- // CHECK:STDERR: ^~~~~~~~~~~~~~
- // CHECK:STDERR: fail_impl_bad_assoc_const.carbon:[[@LINE-5]]:19: note: associated constant declared here [AssociatedConstantHere]
- // CHECK:STDERR: interface I { let T:! type; }
- // CHECK:STDERR: ^~~~~~~~
- // CHECK:STDERR:
- impl () as I {}
- // CHECK:STDOUT: --- fail_impl_bad_assoc_const.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
- // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
- // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
- // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%T [concrete]
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
- // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .I = %I.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
- // CHECK:STDOUT: impl_decl @impl [concrete] {} {
- // CHECK:STDOUT: %.loc23_7.1: %empty_tuple.type = tuple_literal ()
- // CHECK:STDOUT: %.loc23_7.2: type = converted %.loc23_7.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
- // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (<error>), @impl [concrete]
- // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: interface @I {
- // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
- // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] {
- // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%T [concrete = constants.%assoc0]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = %Self
- // CHECK:STDOUT: .T = @T.%assoc0
- // CHECK:STDOUT: witness = (%T)
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: generic assoc_const @T(@I.%Self: %I.type) {
- // CHECK:STDOUT: assoc_const T:! type;
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: impl @impl: %.loc23_7.2 as %I.ref {
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: witness = file.%I.impl_witness
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: specific @T(constants.%Self) {}
- // CHECK:STDOUT:
|