1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Fixed 'concrete' interface matching error reference node

This commit is contained in:
Brian Fiete 2025-01-29 08:03:21 -08:00
parent 5b23020140
commit 91483c90af

View file

@ -7429,12 +7429,18 @@ void BfModule::DoTypeInstanceMethodProcessing(BfTypeInstance* typeInstance)
matchedMethodString.c_str()), matchedMethod->mMethodDef->GetMutNode()); matchedMethodString.c_str()), matchedMethod->mMethodDef->GetMutNode());
mCompiler->mPassInstance->MoreInfo(StrFormat("Declare the interface method as 'mut' to allow matching 'mut' implementations"), ifaceMethodInst->mMethodDef->mMethodDeclaration); 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'", 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); matchedMethodString.c_str(), TypeToString(ifaceMethodInst->mReturnType).c_str()), matchedMethod->mMethodDef->mReturnTypeRef);
if ((ifaceMethodInst->mVirtualTableIdx != -1) && (ifaceMethodInst->mReturnType->IsInterface())) 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);
}
} }
} }
} }