From 91483c90af08b6cbb5b41f8902f85f774cab3641 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Wed, 29 Jan 2025 08:03:21 -0800 Subject: [PATCH] Fixed 'concrete' interface matching error reference node --- IDEHelper/Compiler/BfModuleTypeUtils.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/IDEHelper/Compiler/BfModuleTypeUtils.cpp b/IDEHelper/Compiler/BfModuleTypeUtils.cpp index 44c14b6c..2d37702e 100644 --- a/IDEHelper/Compiler/BfModuleTypeUtils.cpp +++ b/IDEHelper/Compiler/BfModuleTypeUtils.cpp @@ -7429,12 +7429,18 @@ void BfModule::DoTypeInstanceMethodProcessing(BfTypeInstance* typeInstance) matchedMethodString.c_str()), matchedMethod->mMethodDef->GetMutNode()); mCompiler->mPassInstance->MoreInfo(StrFormat("Declare the interface method as 'mut' to allow matching 'mut' implementations"), ifaceMethodInst->mMethodDef->mMethodDeclaration); } - else + else if (!matchedMethod->mReturnType->IsVar()) { mCompiler->mPassInstance->MoreInfo(StrFormat("'%s' cannot match because it does not have the return type '%s'", matchedMethodString.c_str(), TypeToString(ifaceMethodInst->mReturnType).c_str()), matchedMethod->mMethodDef->mReturnTypeRef); if ((ifaceMethodInst->mVirtualTableIdx != -1) && (ifaceMethodInst->mReturnType->IsInterface())) - mCompiler->mPassInstance->MoreInfo("Declare the interface method as 'concrete' to allow matching concrete return values", ifaceMethodInst->mMethodDef->GetMethodDeclaration()->mVirtualSpecifier); + { + BfAstNode* refNode = ifaceMethodInst->mMethodDef->GetRefNode(); + auto methodDecl = ifaceMethodInst->mMethodDef->GetMethodDeclaration(); + if ((methodDecl != NULL) && (methodDecl->mVirtualSpecifier != NULL)) + refNode = methodDecl->mVirtualSpecifier; + mCompiler->mPassInstance->MoreInfo("Declare the interface method as 'concrete' to allow matching concrete return values", refNode); + } } } }