summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorMichal Strehovsk√Ĺ <MichalStrehovsky@users.noreply.github.com>2019-04-08 11:14:39 (GMT)
committerGitHub <noreply@github.com>2019-04-08 11:14:39 (GMT)
commit24c92a5939002ecbadefbc5f93c2c8cc371d8b72 (patch)
treee846057269d2774850af5baa75cb1b3edf7cf8aa /Documentation
parent67e8c9ba99ea32339e2df59d9615a88851fa6dc7 (diff)
downloadcoreclr-24c92a5939002ecbadefbc5f93c2c8cc371d8b72.zip
coreclr-24c92a5939002ecbadefbc5f93c2c8cc371d8b72.tar.gz
coreclr-24c92a5939002ecbadefbc5f93c2c8cc371d8b72.tar.bz2
Allow reabstraction of default interface methods (#23313)
Allow the runtime to load types with incomplete interface implementations. With this change, we allow (in pseudo-C#): ```csharp interface IFoo { void Frob() { } } interface IBar : IFoo { abstract void IFoo.Frob() } class Fooer : IBar { } ``` Calling IFoo.Frob on an instance of `Fooer` will result in new exception being thrown because the default implementation of `IFoo.Frob` was re-abstracted by `IBar`.
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/design-docs/default-interface-methods.md9
1 files changed, 5 insertions, 4 deletions
diff --git a/Documentation/design-docs/default-interface-methods.md b/Documentation/design-docs/default-interface-methods.md
index 738ae0c..0e9e761 100644
--- a/Documentation/design-docs/default-interface-methods.md
+++ b/Documentation/design-docs/default-interface-methods.md
@@ -41,12 +41,13 @@ The algorithm is amended as follows:
* If the interface method itself is not abstract, add it to the list.
* Apply all MethodImpls specified in the list of interfaces implicitly implemented by the runtime class of the instance through which the interface method is invoked and add the methods to the list.
* Go over the owning types of each of the candidate methods in the list. If the owning type is less concrete than some other type in the list (there is another method in the list whose owning type requires the less concrete type), remove it from the list.
- * If there's more than one method in the list, throw NotSupportedException
- * If there's exactly one method in the list call that method
+ * If there's more than one method in the list, throw AmbiguousImplementationException
+ * If there's exactly one method in the list and the method is not abstract, call that method
+ * If there's exactly one method in the list but the method is abstract, throw `EntryPointNotFoundException`.
* If there's no method in the list and the interface is variant, repeat the above algorithm, looking for a variant match. Return the first variant match provided by a most specific interface.
**Section** "III.2.1 constrained. prefix" the paragraph starting with "This last case can only occur when method was defined on `System.Object`, `System.ValueType`, or `System.Enum`" is extended to also cover default interface method implementation. In the case the interface method implementation is provided by an interface, the implicit boxing becomes _observable_ to the program.
-**Section** "III.4.2 callvirt" is extended to allow throwing `AmbiguousImplementationException` if the implementation of the interface method resolves at runtime to more than one default interface method.
+**Section** "III.4.2 callvirt" is extended to allow throwing `AmbiguousImplementationException` if the implementation of the interface method resolves at runtime to more than one default interface method. It's also extended to specify throwing `EntryPointNotFoundException` if the default interface implementation is abstract.
-**Section** "III.4.18 ldvirtftn" is extended to allow throwing `AmbiguousImplementationException` if the implementation of the interface method resolves at runtime to more than one default interface method.
+**Section** "III.4.18 ldvirtftn" is extended to allow throwing `AmbiguousImplementationException` if the implementation of the interface method resolves at runtime to more than one default interface method. It's also extended to specify throwing `EntryPointNotFoundException` if the default interface implementation is abstract.