summaryrefslogtreecommitdiff
path: root/src/vm/methodtable.cpp
diff options
context:
space:
mode:
authorYi Zhang (CLR) <yizhang82@users.noreply.github.com>2017-04-07 17:36:48 -0700
committerYi Zhang (CLR) <yzha@microsoft.com>2017-07-19 11:16:55 -0700
commit9b8471b34c8fad1694ea0e9562e4699ac4eeda6e (patch)
treecbdca8a41fe7dcaced097af7b7c2e72e9f840c5f /src/vm/methodtable.cpp
parentdcf60f83a0557b3c2fbb705a4fdb3bade0e14854 (diff)
downloadcoreclr-9b8471b34c8fad1694ea0e9562e4699ac4eeda6e.tar.gz
coreclr-9b8471b34c8fad1694ea0e9562e4699ac4eeda6e.tar.bz2
coreclr-9b8471b34c8fad1694ea0e9562e4699ac4eeda6e.zip
More update for default interface methods (#10818)
* Support protected methods * add a test for diamond shape scenario and tentatively throw exception when that happens
Diffstat (limited to 'src/vm/methodtable.cpp')
-rw-r--r--src/vm/methodtable.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/vm/methodtable.cpp b/src/vm/methodtable.cpp
index 474c611bf8..7247dd06eb 100644
--- a/src/vm/methodtable.cpp
+++ b/src/vm/methodtable.cpp
@@ -7058,12 +7058,20 @@ BOOL MethodTable::FindDefaultMethod(
);
}
- if (pBestCandidateMT == NULL || // first time
- pCurMT->CanCastToInterface(pBestCandidateMT)) // Prefer "more specific"" interface
- {
- // This is a better match
- pBestCandidateMT = pCurMT;
- pBestCandidateMD = pCurMD;
+ if (pBestCandidateMT != pCurMT)
+ {
+ if (pBestCandidateMT == NULL || // first time
+ pCurMT->CanCastToInterface(pBestCandidateMT)) // Prefer "more specific"" interface
+ {
+ // This is a better match
+ pBestCandidateMT = pCurMT;
+ pBestCandidateMD = pCurMD;
+ }
+ else
+ {
+ // not good. we have a conflict
+ COMPlusThrow(kNotSupportedException);
+ }
}
}