diff --git a/IDEHelper/Compiler/BfExprEvaluator.cpp b/IDEHelper/Compiler/BfExprEvaluator.cpp index 7f31728d..f60515ec 100644 --- a/IDEHelper/Compiler/BfExprEvaluator.cpp +++ b/IDEHelper/Compiler/BfExprEvaluator.cpp @@ -19315,12 +19315,16 @@ void BfExprEvaluator::PerformBinaryOperation(BfAstNode* leftExpression, BfAstNod } // Valueless types always compare as 'equal' - if ((leftValue.mType == rightValue.mType) && (leftValue.mType->IsValuelessType())) + if (leftValue.mType == rightValue.mType) { - auto boolType = mModule->GetPrimitiveType(BfTypeCode_Boolean); - bool isEqual = (binaryOp == BfBinaryOp_Equality) || (binaryOp == BfBinaryOp_StrictEquality); - mResult = BfTypedValue(mModule->GetConstValue(isEqual ? 1 : 0, boolType), boolType); - return; + mModule->PopulateType(leftValue.mType); + if (leftValue.mType->IsValuelessType()) + { + auto boolType = mModule->GetPrimitiveType(BfTypeCode_Boolean); + bool isEqual = (binaryOp == BfBinaryOp_Equality) || (binaryOp == BfBinaryOp_StrictEquality); + mResult = BfTypedValue(mModule->GetConstValue(isEqual ? 1 : 0, boolType), boolType); + return; + } } } diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index 61fc7014..b58361bf 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -9474,14 +9474,14 @@ BfMethodInstance* BfModule::GetRawMethodByName(BfTypeInstance* typeInstance, con } BfMethodInstance* BfModule::GetUnspecializedMethodInstance(BfMethodInstance* methodInstance, bool useUnspecializedType) -{ +{ if ((methodInstance->mMethodInfoEx != NULL) && (methodInstance->mMethodInfoEx->mMethodGenericArguments.size() != 0)) methodInstance = methodInstance->mMethodInstanceGroup->mDefault; auto owner = methodInstance->mMethodInstanceGroup->mOwner; if (!useUnspecializedType) - return GetRawMethodInstanceAtIdx(owner, methodInstance->mMethodDef->mIdx); + return methodInstance; if (!owner->IsGenericTypeInstance()) return methodInstance; @@ -17320,9 +17320,9 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup) methodState.mGenericTypeBindings = &methodInstance->GetMethodInfoEx()->mGenericTypeBindings; } else if ((((methodInstance->mMethodInfoEx != NULL) && ((int)methodInstance->mMethodInfoEx->mMethodGenericArguments.size() > dependentGenericStartIdx)) || - ((mCurTypeInstance->IsGenericTypeInstance()) && (!isGenericVariation)))) + ((mCurTypeInstance->IsGenericTypeInstance()) && (!isGenericVariation) && (!methodInstance->mMethodDef->mIsLocalMethod)))) { - unspecializedMethodInstance = GetUnspecializedMethodInstance(methodInstance); + unspecializedMethodInstance = GetUnspecializedMethodInstance(methodInstance, !methodInstance->mMethodDef->mIsLocalMethod); BF_ASSERT(unspecializedMethodInstance != methodInstance); if (!unspecializedMethodInstance->mHasBeenProcessed) diff --git a/IDEHelper/Tests/src/LocalFunctions.bf b/IDEHelper/Tests/src/LocalFunctions.bf index 42f6c9d7..937afa99 100644 --- a/IDEHelper/Tests/src/LocalFunctions.bf +++ b/IDEHelper/Tests/src/LocalFunctions.bf @@ -6,6 +6,25 @@ namespace Tests { class LocalFunctions { + class ClassA + { + public int Get() + { + int LocalA() + { + return 123; + } + + int LocalB(T3 val) where T3 : IHashable + { + val.GetHashCode(); + return 234; + } + + return LocalA() + LocalB(1.2f); + } + } + [Test] static void TestA() { @@ -23,6 +42,9 @@ namespace Tests FuncA(); Test.Assert(a == 101); + + ClassA ca = scope .(); + Test.Assert(ca.Get() == 357); } [Test]