From 0a2596ce3d7fb0253f30b2461fa910c65840f9b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Fri, 18 Jan 2019 11:18:56 +0100 Subject: Use correct resolution scope when checking default implementations (#22036) We need to use the module of the interface. Fixes #22021. --- src/vm/methodtablebuilder.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/vm/methodtablebuilder.cpp') diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp index e47474c8e9..688d98ac90 100644 --- a/src/vm/methodtablebuilder.cpp +++ b/src/vm/methodtablebuilder.cpp @@ -10787,6 +10787,8 @@ BOOL MethodTableBuilder::HasDefaultInterfaceImplementation(bmtRTType *pDeclType, { bmtRTType * pCurItf = bmtInterface->pInterfaceMap[i].GetInterfaceType(); + Module * pCurIntfModule = pCurItf->GetMethodTable()->GetModule(); + // Go over the methods on the interface MethodTable::IntroducedMethodIterator methIt(pCurItf->GetMethodTable()); for (; methIt.IsValid(); methIt.Next()) @@ -10810,11 +10812,11 @@ BOOL MethodTableBuilder::HasDefaultInterfaceImplementation(bmtRTType *pDeclType, // Find out what interface this default implementation is implementing mdToken tkParent; - IfFailThrow(GetModule()->GetMDImport()->GetParentToken(it.GetToken(), &tkParent)); + IfFailThrow(pCurIntfModule->GetMDImport()->GetParentToken(it.GetToken(), &tkParent)); // We can only load the approximate interface at this point MethodTable * pPotentialInterfaceMT = ClassLoader::LoadTypeDefOrRefOrSpecThrowing( - GetModule(), + pCurIntfModule, tkParent, &bmtGenerics->typeContext, ClassLoader::ThrowIfNotFound, @@ -10831,7 +10833,7 @@ BOOL MethodTableBuilder::HasDefaultInterfaceImplementation(bmtRTType *pDeclType, return TRUE; // If this is generic, we need to compare under substitutions - Substitution curItfSubs(tkParent, GetModule(), &pCurItf->GetSubstitution()); + Substitution curItfSubs(tkParent, pCurIntfModule, &pCurItf->GetSubstitution()); // Type Equivalence is not respected for this comparision as you can have multiple type equivalent interfaces on a class TokenPairList newVisited = TokenPairList::AdjustForTypeEquivalenceForbiddenScope(NULL); -- cgit v1.2.3