mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Improved handling of multiple declarations of required system types
This commit is contained in:
parent
2e9a2f3eb3
commit
2f6d9e03ab
1 changed files with 19 additions and 1 deletions
|
@ -7222,15 +7222,33 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
|
|||
mHasRequiredTypes = true;
|
||||
|
||||
//HashSet<BfTypeDef*> internalTypeDefs;
|
||||
|
||||
BfProject* corlibProject = NULL;
|
||||
|
||||
auto _GetRequiredType = [&](const StringImpl& typeName, int genericArgCount = 0)
|
||||
{
|
||||
auto typeDef = mSystem->FindTypeDef(typeName, genericArgCount);
|
||||
BfTypeDef* ambigiousTypeDef = NULL;
|
||||
auto typeDef = mSystem->FindTypeDef(typeName, genericArgCount, NULL, {}, &ambigiousTypeDef);
|
||||
if (typeDef == NULL)
|
||||
{
|
||||
mPassInstance->Fail(StrFormat("Unable to find system type: %s", typeName.c_str()));
|
||||
mHasRequiredTypes = false;
|
||||
}
|
||||
|
||||
if (ambigiousTypeDef != NULL)
|
||||
{
|
||||
mPassInstance->Fail(StrFormat("Found multiple declarations of require type '%s'", typeName.c_str()), typeDef->GetRefNode());
|
||||
mPassInstance->MoreInfo("See additional declaration", ambigiousTypeDef->GetRefNode());
|
||||
if (typeDef->mProject != corlibProject)
|
||||
{
|
||||
auto rootTypeDef = mSystem->FindTypeDef(typeName, genericArgCount, corlibProject);
|
||||
if (rootTypeDef != NULL)
|
||||
typeDef = rootTypeDef;
|
||||
}
|
||||
}
|
||||
|
||||
if (corlibProject == NULL)
|
||||
corlibProject = typeDef->mProject;
|
||||
return typeDef;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue