mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Suppress 'hides inherited member' from base extension. Added MoreInfo
This commit is contained in:
parent
ab31e5bc89
commit
936dd656c8
1 changed files with 9 additions and 2 deletions
|
@ -25058,14 +25058,17 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
|
||||||
(checkMethod->mProtection != BfProtection_Private) &&
|
(checkMethod->mProtection != BfProtection_Private) &&
|
||||||
(CompareMethodSignatures(checkMethodInstance, mCurMethodInstance)))
|
(CompareMethodSignatures(checkMethodInstance, mCurMethodInstance)))
|
||||||
{
|
{
|
||||||
if (!methodDef->mIsNew)
|
if ((!methodDef->mIsNew) && (!checkMethod->mDeclaringType->IsExtension()))
|
||||||
{
|
{
|
||||||
BfAstNode* refNode = methodInstance->mMethodDef->GetRefNode();
|
BfAstNode* refNode = methodInstance->mMethodDef->GetRefNode();
|
||||||
if (refNode != NULL)
|
if (refNode != NULL)
|
||||||
{
|
{
|
||||||
BfError* bfError = Warn(BfWarning_CS0114_MethodHidesInherited, StrFormat("Method hides inherited member from '%s'. Use the 'new' keyword if the hiding was intentional.", TypeToString(baseType).c_str()), refNode); //CDH TODO should we mention override keyword in warning text?
|
BfError* bfError = Warn(BfWarning_CS0114_MethodHidesInherited, StrFormat("Method hides inherited member from '%s'. Use the 'new' keyword if the hiding was intentional.", TypeToString(baseType).c_str()), refNode); //CDH TODO should we mention override keyword in warning text?
|
||||||
if (bfError != NULL)
|
if (bfError != NULL)
|
||||||
|
{
|
||||||
bfError->mIsPersistent = true;
|
bfError->mIsPersistent = true;
|
||||||
|
mCompiler->mPassInstance->MoreInfo("See inherited method", checkMethod->GetRefNode());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foundHiddenMethod = true;
|
foundHiddenMethod = true;
|
||||||
|
@ -25992,7 +25995,11 @@ bool BfModule::SlotInterfaceMethod(BfMethodInstance* methodInstance)
|
||||||
}
|
}
|
||||||
else if (!methodDef->mIsNew)
|
else if (!methodDef->mIsNew)
|
||||||
{
|
{
|
||||||
Warn(BfWarning_CS0114_MethodHidesInherited, StrFormat("Method hides inherited member from '%s'. Use the 'new' keyword if hiding was intentional.", TypeToString(ifaceInst).c_str()), declaringNode);
|
auto error = Warn(BfWarning_CS0114_MethodHidesInherited, StrFormat("Method hides inherited member from '%s'. Use the 'new' keyword if hiding was intentional.", TypeToString(ifaceInst).c_str()), declaringNode);
|
||||||
|
if (error != NULL)
|
||||||
|
{
|
||||||
|
mCompiler->mPassInstance->MoreInfo("See inherited method", ifaceMethod->mMethodDef->GetRefNode());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue