mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Fix generic binding in generic mixins
This commit is contained in:
parent
627b0381f8
commit
51eaa6276f
3 changed files with 47 additions and 4 deletions
|
@ -3308,8 +3308,31 @@ BfType* BfExprEvaluator::BindGenericType(BfAstNode* node, BfType* bindType)
|
|||
int64 nodeId = ((int64)parser->mDataId << 32) + node->GetSrcStart();
|
||||
|
||||
auto genericTypeBindings = mModule->mCurMethodState->GetRootMethodState()->mGenericTypeBindings;
|
||||
auto methodInstance = mModule->mCurMethodInstance;
|
||||
|
||||
if ((mModule->mCurMethodInstance->mIsUnspecialized) && (!mModule->mCurMethodInstance->mIsUnspecializedVariation))
|
||||
if (mModule->mCurMethodState->mMixinState != NULL)
|
||||
{
|
||||
auto mixinMethodInstance = mModule->mCurMethodState->mMixinState->mMixinMethodInstance;
|
||||
if (!mixinMethodInstance->mMethodDef->mGenericParams.IsEmpty())
|
||||
{
|
||||
auto unspecMixinMethodInstance = mModule->GetUnspecializedMethodInstance(mixinMethodInstance, false);
|
||||
|
||||
if (!unspecMixinMethodInstance->mHasBeenProcessed)
|
||||
{
|
||||
// Make sure the unspecialized method is processed so we can take its bindings
|
||||
// Clear mCurMethodState so we don't think we're in a local method
|
||||
SetAndRestoreValue<BfMethodState*> prevMethodState_Unspec(mModule->mCurMethodState, NULL);
|
||||
if (unspecMixinMethodInstance->mMethodProcessRequest == NULL)
|
||||
unspecMixinMethodInstance->mDeclModule->mIncompleteMethodCount++;
|
||||
mModule->mContext->ProcessMethod(unspecMixinMethodInstance);
|
||||
}
|
||||
|
||||
methodInstance = mixinMethodInstance;
|
||||
genericTypeBindings = &unspecMixinMethodInstance->mMethodInfoEx->mGenericTypeBindings;
|
||||
}
|
||||
}
|
||||
|
||||
if ((methodInstance->mIsUnspecialized) && (!methodInstance->mIsUnspecializedVariation))
|
||||
{
|
||||
if (!bindType->IsGenericParam())
|
||||
return bindType;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue