diff --git a/explorer/interpreter/interpreter.cpp b/explorer/interpreter/interpreter.cpp index 77f101e72046..11321c45bf31 100644 --- a/explorer/interpreter/interpreter.cpp +++ b/explorer/interpreter/interpreter.cpp @@ -1316,7 +1316,12 @@ auto Interpreter::StepExp() -> ErrorOr { } else { // { { v :: [][i] :: C, E, F} :: S, H} // -> { { v_i :: C, E, F} : S, H} - const auto& tuple = cast(*act.results()[0]); + CARBON_ASSIGN_OR_RETURN( + auto converted, + Convert(act.results()[0], + &cast(exp).object().static_type(), + exp.source_loc())); + const auto& tuple = cast(*converted); int i = cast(*act.results()[1]).value(); if (i < 0 || i >= static_cast(tuple.elements().size())) { return ProgramError(exp.source_loc()) diff --git a/explorer/testdata/impl/fail_impl_as_symbolic.carbon b/explorer/testdata/impl/fail_impl_as_symbolic.carbon new file mode 100644 index 000000000000..659ce78ea451 --- /dev/null +++ b/explorer/testdata/impl/fail_impl_as_symbolic.carbon @@ -0,0 +1,14 @@ +// 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 + +package ExplorerTest api; + +// CHECK:STDERR: COMPILATION ERROR: fail_impl_as_symbolic.carbon:[[@LINE+1]]: value of generic binding T is not known +impl forall [T:! ({}, )] {} as T { +} + +fn Main() -> i32 { +} diff --git a/explorer/testdata/impl/fail_impl_symbolic_as.carbon b/explorer/testdata/impl/fail_impl_symbolic_as.carbon new file mode 100644 index 000000000000..f654bc329cee --- /dev/null +++ b/explorer/testdata/impl/fail_impl_symbolic_as.carbon @@ -0,0 +1,15 @@ +// 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 + +package ExplorerTest api; + +interface X { +} +// CHECK:STDERR: COMPILATION ERROR: fail_impl_symbolic_as.carbon:[[@LINE+1]]: value of generic binding Y is not known +impl forall [Y:! (X, )] Y as true { +} +fn Main() -> i32 { +}