mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Fixed 'new' methods where extension is in same project as orig decl
This commit is contained in:
parent
f2b177693d
commit
4289d718d6
1 changed files with 15 additions and 8 deletions
|
@ -24420,16 +24420,17 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
|
||||||
methodInstance->mIsInnerOverride = true;
|
methodInstance->mIsInnerOverride = true;
|
||||||
CheckOverridenMethod(methodInstance, checkMethodInstance);
|
CheckOverridenMethod(methodInstance, checkMethodInstance);
|
||||||
}
|
}
|
||||||
else if ((methodDef->mDeclaringType->mProject != checkMethod->mDeclaringType->mProject) &&
|
else if (!checkMethod->mDeclaringType->IsExtension())
|
||||||
(!checkMethod->mDeclaringType->IsExtension()))
|
|
||||||
{
|
{
|
||||||
foundHiddenMethod = true;
|
foundHiddenMethod = true;
|
||||||
if ((methodDef->mMethodType == BfMethodType_Ctor) && (methodDef->mIsStatic))
|
if ((methodDef->mMethodType == BfMethodType_Ctor) && (methodDef->mIsStatic))
|
||||||
silentlyAllow = true;
|
silentlyAllow = true;
|
||||||
else if (methodDef->mIsNew)
|
else if (methodDef->mIsNew)
|
||||||
{
|
{
|
||||||
silentlyAllow = true;
|
silentlyAllow = true;
|
||||||
}
|
}
|
||||||
|
else if (checkMethod->GetMethodDeclaration() == NULL)
|
||||||
|
silentlyAllow = true;
|
||||||
else
|
else
|
||||||
extensionWarn = true;
|
extensionWarn = true;
|
||||||
}
|
}
|
||||||
|
@ -24448,19 +24449,25 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
|
||||||
auto refNode = methodDef->GetRefNode();
|
auto refNode = methodDef->GetRefNode();
|
||||||
BfError* bfError;
|
BfError* bfError;
|
||||||
if (extensionWarn)
|
if (extensionWarn)
|
||||||
bfError = Warn(BfWarning_CS0114_MethodHidesInherited,
|
{
|
||||||
StrFormat("This method hides a method in the root type definition. Use the 'new' keyword if the hiding was intentional. Note that this method is not callable from project '%s'.",
|
if (methodDef->mDeclaringType->mProject != checkMethod->mDeclaringType->mProject)
|
||||||
checkMethod->mDeclaringType->mProject->mName.c_str()), refNode);
|
bfError = Warn(BfWarning_CS0114_MethodHidesInherited,
|
||||||
|
StrFormat("This method hides a method in the root type definition. Use the 'new' keyword if the hiding was intentional. Note that this method is not callable from project '%s'.",
|
||||||
|
checkMethod->mDeclaringType->mProject->mName.c_str()), refNode);
|
||||||
|
else
|
||||||
|
bfError = Warn(BfWarning_CS0114_MethodHidesInherited,
|
||||||
|
"This method hides a method in the root type definition. Use the 'new' keyword if the hiding was intentional.", refNode);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bfError = Fail(StrFormat("Method '%s' already declared with the same parameter types", MethodToString(checkMethodInstance).c_str()), refNode, true);
|
bfError = Fail(StrFormat("Method '%s' already declared with the same parameter types", MethodToString(checkMethodInstance).c_str()), refNode, true);
|
||||||
}
|
}
|
||||||
if ((bfError != NULL) && (checkMethod->GetRefNode() != refNode))
|
if ((bfError != NULL) && (checkMethod->GetRefNode() != refNode))
|
||||||
mCompiler->mPassInstance->MoreInfo("First declaration", checkMethod->GetRefNode());
|
mCompiler->mPassInstance->MoreInfo("First declaration", checkMethod->GetRefNode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue