@@ -1554,6 +1554,18 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
15541554 }
15551555 }
15561556
1557+ // Devirtualized calls (ie: 'base.Method()') route through a thunk when a type extension may
1558+ // supply a different override - each executable's vdata resolves that thunk for itself.
1559+ for (auto type : vdataTypeList)
1560+ {
1561+ if ((!type->IsReified ()) || (type->IsUnspecializedType ()) || (type->IsTypeAlias ()))
1562+ continue ;
1563+ auto typeInst = type->ToTypeInstance ();
1564+ if (typeInst == NULL )
1565+ continue ;
1566+ bfModule->CreateDevirtThunks (typeInst);
1567+ }
1568+
15571569 for (int typeId = 0 ; typeId < (int )typeDataVector.size (); typeId++)
15581570 {
15591571 if (!typeDataVector[typeId])
@@ -6054,7 +6066,8 @@ void BfCompiler::PopulateReified()
60546066 {
60556067 if ((methodDef->mIsOverride ) && (methodDef->mParams .mSize == declaringMethod->mMethodDef ->mParams .mSize ))
60566068 {
6057- auto implMethod = typeInst->mModule ->GetRawMethodInstance (typeInst, methodDef);
6069+ // 'methodDef' is from checkTypeInst's method set, so mIdx indexes that type's methods
6070+ auto implMethod = typeInst->mModule ->GetRawMethodInstance (checkTypeInst, methodDef);
60586071 if ((implMethod != NULL ) && (typeInst->mModule ->CompareMethodSignatures (declaringMethod, implMethod)))
60596072 {
60606073 if ((implMethod != NULL ) && ((!implMethod->mMethodInstanceGroup ->IsImplemented ()) || (!implMethod->mIsReified )))
@@ -7437,11 +7450,7 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
74377450 mPassInstance ->Fail (StrFormat (" Project '%s' must reference core library '%s'" , bfProject->mName .c_str (), mBfObjectTypeDef ->mProject ->mName .c_str ()));
74387451 }
74397452
7440- if ((bfProject->mTargetType != BfTargetType_BeefConsoleApplication) && (bfProject->mTargetType != BfTargetType_BeefWindowsApplication) &&
7441- (bfProject->mTargetType != BfTargetType_BeefLib_DynamicLib) && (bfProject->mTargetType != BfTargetType_BeefLib_StaticLib) &&
7442- (bfProject->mTargetType != BfTargetType_C_ConsoleApplication) && (bfProject->mTargetType != BfTargetType_C_WindowsApplication) &&
7443- (bfProject->mTargetType != BfTargetType_BeefTest) &&
7444- (bfProject->mTargetType != BfTargetType_BeefApplication_StaticLib) && (bfProject->mTargetType != BfTargetType_BeefApplication_DynamicLib))
7453+ if (!bfProject->IsFinalProgramTarget ())
74457454 continue ;
74467455
74477456 if (bfProject->mTargetType == BfTargetType_BeefTest)
0 commit comments