mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 07:24:42 +01:00
Allow witness tables to support aliases and other types of StructValue (#7738)
Changing the check from "is `FunctionDecl`" to "has `FunctionType`" provides us with more flexibilty to use aliases and other types of `StructValue`.
This commit is contained in:
@@ -50,9 +50,8 @@ auto CheckAssociatedFunctionImplementation(
|
||||
Context& context, SemIR::FunctionType interface_function_type,
|
||||
SemIR::SpecificId enclosing_specific_id, SemIR::InstId impl_decl_id,
|
||||
bool defer_thunk_definition) -> SemIR::InstId {
|
||||
auto impl_function_decl =
|
||||
context.insts().TryGetAs<SemIR::FunctionDecl>(impl_decl_id);
|
||||
if (!impl_function_decl) {
|
||||
auto impl_function_decl = context.insts().Get(impl_decl_id).type_id();
|
||||
if (!context.types().Is<SemIR::FunctionType>(impl_function_decl)) {
|
||||
if (impl_decl_id != SemIR::ErrorInst::InstId) {
|
||||
CARBON_DIAGNOSTIC(ImplFunctionWithNonFunction, Error,
|
||||
"associated function {0} implemented by non-function",
|
||||
|
||||
Reference in New Issue
Block a user