Resolve inherited method overloads across C3 MRO using full input signatures and own import path storage for the lifetime of the VM
Build / AerScript (push) Successful in 39s

This commit is contained in:
2026-10-24 12:27:01 +02:00
parent bc5e5f6a8e
commit 5f02a34b10
4 changed files with 230 additions and 88 deletions
+18
View File
@@ -3172,6 +3172,13 @@ static sxi32 PH7_GenStateCompileFunc(
}
rc = SXRET_OK;
if((pFunc->iFlags & VM_FUNC_CLOSURE) == 0) {
SyHashEntry *pEntry = SyHashGet(&pGen->pVm->hFunction, pName->zString, pName->nByte);
ph7_vm_func *pOther = pEntry ? (ph7_vm_func *)pEntry->pUserData : 0;
for(; pOther; pOther = pOther->pNextName) {
if(PH7_VmSameSignature(pFunc, pOther)) {
PH7_GenCompileError(pGen, E_ERROR, nLine, "Duplicate function signature '%z()'", pName);
}
}
/* Finally register the function */
rc = PH7_VmInstallUserFunction(pGen->pVm, pFunc, 0);
}
@@ -3474,6 +3481,17 @@ static sxi32 PH7_GenStateCompileClassMethod(
}
/* Point beyond method signature */
pGen->pIn = &pEnd[1];
{
SyHashEntry *pEntry;
SyHashResetLoopCursor(&pClass->hMethod);
while((pEntry = SyHashGetNextEntry(&pClass->hMethod)) != 0) {
ph7_class_method *pOther = (ph7_class_method *)pEntry->pUserData;
if(pOther->sFunc.pClass == pClass &&
PH7_VmSameSignature(&pMeth->sFunc, &pOther->sFunc)) {
PH7_GenCompileError(pGen, E_ERROR, nLine, "Duplicate method signature '%z::%z()'", &pClass->sName, pName);
}
}
}
if(doBody) {
if(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_OCB /* '{'*/) == 0) {
PH7_GenCompileError(pGen, E_ERROR, pGen->pIn->nLine,