mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Extension check refinements, more extension tests
This commit is contained in:
parent
f0a6ec4870
commit
2d4cc6d86e
4 changed files with 42 additions and 40 deletions
|
@ -212,6 +212,9 @@ void BfMethodMatcher::Init(/*SizedArrayImpl<BfResolvedArg>& arguments, */BfSized
|
|||
|
||||
bool BfMethodMatcher::IsMemberAccessible(BfTypeInstance* typeInst, BfTypeDef* declaringType)
|
||||
{
|
||||
if (!declaringType->mIsPartial)
|
||||
return true;
|
||||
|
||||
if (mActiveTypeDef == NULL)
|
||||
mActiveTypeDef = mModule->GetActiveTypeDef();
|
||||
|
||||
|
|
|
@ -2914,7 +2914,6 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
|||
bool populateChildType = !typeInstance->mTypeFailed;
|
||||
//bool populateChildType = true;
|
||||
PopulateType(resolvedFieldType, populateChildType ? BfPopulateType_Data : BfPopulateType_Declaration);
|
||||
BF_ASSERT(!typeInstance->mNeedsMethodProcessing);
|
||||
|
||||
if (populateChildType)
|
||||
{
|
||||
|
|
|
@ -2093,8 +2093,6 @@ bool BfTypeInstance::IsTypeMemberIncluded(BfTypeDef* typeDef, BfTypeDef* activeT
|
|||
return true;
|
||||
if ((typeDef == NULL) || (typeDef == activeTypeDef))
|
||||
return true;
|
||||
if (typeDef->mTypeDeclaration == mTypeDef->mTypeDeclaration)
|
||||
return true;
|
||||
|
||||
// The combined type declaration is the root type declaration, it's implicitly included
|
||||
if (typeDef->mTypeDeclaration == mTypeDef->mTypeDeclaration)
|
||||
|
@ -2125,42 +2123,12 @@ bool BfTypeInstance::IsTypeMemberIncluded(BfTypeDef* typeDef, BfTypeDef* activeT
|
|||
genericArg = declGenericParam->mExternType;
|
||||
}
|
||||
|
||||
//auto genericType = mGenericTypeInfo->mTypeGenericArguments[genericIdx];
|
||||
|
||||
if ((genericArg == NULL) || (!module->CheckGenericConstraints(BfGenericParamSource(), genericArg, NULL, declGenericParam)))
|
||||
return false;
|
||||
|
||||
//if (!mModule->AreConstraintsSubset((*declConstraints)[genericIdx], (*activeConstraints)[genericIdx]))
|
||||
//isSubset = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/*else if ((mIsUnspecialized) && (activeTypeDef != NULL))
|
||||
{
|
||||
auto subsetItr = genericExEntry->mConstraintSubsetMap.find(activeTypeDef);
|
||||
if (subsetItr != genericExEntry->mConstraintSubsetMap.end())
|
||||
{
|
||||
return subsetItr->second;
|
||||
}
|
||||
|
||||
auto declConstraints = &genericExEntry->mGenericParams;
|
||||
auto activeConstraints = GetGenericParamsVector(activeTypeDef);
|
||||
|
||||
bool isSubset = true;
|
||||
for (int genericIdx = 0; genericIdx < (int)declConstraints->size(); genericIdx++)
|
||||
{
|
||||
if (!mModule->AreConstraintsSubset((*declConstraints)[genericIdx], (*activeConstraints)[genericIdx]))
|
||||
isSubset = false;
|
||||
}
|
||||
|
||||
// We can't cache this because the meaning of the params may change, IE: TypeName<@M0> needs to consider the
|
||||
// constraints of @M0 for each method it is checked against
|
||||
if (!IsUnspecializedTypeVariation())
|
||||
genericExEntry->mConstraintSubsetMap[activeTypeDef] = isSubset;
|
||||
|
||||
return isSubset;
|
||||
}*/
|
||||
|
||||
return genericExEntry->mConstraintsPassed;
|
||||
}
|
||||
|
|
|
@ -74,6 +74,26 @@ namespace Tests
|
|||
public int32 mB;
|
||||
}
|
||||
|
||||
class ClassB : IHashable
|
||||
{
|
||||
public int32 mA;
|
||||
|
||||
public this(int32 a)
|
||||
{
|
||||
mA = a;
|
||||
}
|
||||
|
||||
public static bool operator==(ClassB lhs, ClassB rhs)
|
||||
{
|
||||
return lhs.mA == rhs.mA;
|
||||
}
|
||||
|
||||
public int GetHashCode()
|
||||
{
|
||||
return mA;
|
||||
}
|
||||
}
|
||||
|
||||
class TClassA<T> where T : IDisposable
|
||||
{
|
||||
public int32 mA = 10;
|
||||
|
@ -185,11 +205,23 @@ namespace Tests
|
|||
[Test]
|
||||
public static void TestDictionary()
|
||||
{
|
||||
Dictionary<String, int> dictLhs = scope .() {("Abc", 123), ("Def", 234) };
|
||||
Dictionary<String, int> dictrhs = scope .() {(scope:: String("Abc"), 123), ("Def", 234) };
|
||||
Dictionary<String, int> dictLhs = scope .() { ("Abc", 123), ("Def", 234) };
|
||||
Dictionary<String, int> dictRhs = scope .() { (scope:: String("Abc"), 123), ("Def", 234) };
|
||||
|
||||
Test.Assert(dictLhs == dictrhs);
|
||||
Test.Assert(!LibA.LibA0.DictEquals(dictLhs, dictrhs));
|
||||
Test.Assert(dictLhs == dictRhs);
|
||||
Test.Assert(!LibA.LibA0.DictEquals(dictLhs, dictRhs));
|
||||
|
||||
Dictionary<String, int>[2] dictArrLhs = .(dictLhs, dictLhs);
|
||||
Dictionary<String, int>[2] dictArrRhs = .(dictRhs, dictRhs);
|
||||
Test.Assert(dictArrLhs != dictArrRhs);
|
||||
|
||||
Dictionary<ClassB, int> dictLhs2 = scope .() { (scope:: ClassB(111), 123) };
|
||||
Dictionary<ClassB, int> dictRhs2 = scope .() { (scope:: ClassB(111), 123) };
|
||||
Test.Assert(dictLhs2 == dictRhs2);
|
||||
|
||||
Dictionary<ClassB, int>[2] dictArrLhs2 = .(dictLhs2, dictLhs2);
|
||||
Dictionary<ClassB, int>[2] dictArrRhs2 = .(dictRhs2, dictRhs2);
|
||||
Test.Assert(dictArrLhs2 == dictArrRhs2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue