mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
Fix for boxed interface selection with multiple entries
This commit is contained in:
parent
4cea33d96f
commit
e0ebe81472
1 changed files with 19 additions and 2 deletions
|
@ -5196,9 +5196,26 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
|
|||
_InterfaceMatchEntry* matchEntry = NULL;
|
||||
if (interfaceMap.TryGetValue(interfaceEntry.mInterfaceType, &matchEntry))
|
||||
{
|
||||
BfTypeInstance* compareCheckTypeInst = checkTypeInst;
|
||||
if (compareCheckTypeInst->IsBoxed())
|
||||
compareCheckTypeInst = compareCheckTypeInst->GetUnderlyingType()->ToTypeInstance();
|
||||
BfTypeInstance* compareEntrySource = matchEntry->mEntrySource;
|
||||
if (compareEntrySource->IsBoxed())
|
||||
compareEntrySource = compareEntrySource->GetUnderlyingType()->ToTypeInstance();
|
||||
|
||||
auto prevEntry = matchEntry->mEntry;
|
||||
bool isBetter = TypeIsSubTypeOf(checkTypeInst, matchEntry->mEntrySource);
|
||||
bool isWorse = TypeIsSubTypeOf(matchEntry->mEntrySource, checkTypeInst);
|
||||
bool isBetter = TypeIsSubTypeOf(compareCheckTypeInst, compareEntrySource);
|
||||
bool isWorse = TypeIsSubTypeOf(compareEntrySource, compareCheckTypeInst);
|
||||
|
||||
if ((!isBetter) && (!isWorse))
|
||||
{
|
||||
// Unboxed comparison to Object fix
|
||||
if (compareCheckTypeInst == mContext->mBfObjectType)
|
||||
isWorse = true;
|
||||
else if (compareEntrySource == mContext->mBfObjectType)
|
||||
isBetter = true;
|
||||
}
|
||||
|
||||
if (forceInterfaceSet)
|
||||
{
|
||||
isBetter = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue