Discriminate calls with implicit dynamic receivers

This commit is contained in:
Andrey Breslav
2014-12-10 15:28:06 +03:00
parent fbb4ed181a
commit d17edacb65
12 changed files with 192 additions and 20 deletions
+2
View File
@@ -81,6 +81,8 @@ If a receiver of a call is dynamic, the following resolution rules apply:
this permits calling them on vals (e.g. those holding collection-like objects)
- The invoke convention is limited so that for calls like `dyn.foo()` we do not look for property `foo` that has `invoke` defined on it
(same for other cases like `+dyn` etc)
- dynamic candidates with no explicit dispatch receiver are discriminated against all other candidate, i.e. for a call `foo()`, we first try
to match static candidates, and only then dynamic ones.
NOTE: we do not even try to resolve extensions declared for static types if the receiver is dynamic. As a workaround, one may use an upcast
to a static type: `(dyn as Foo).extensionForFoo()`.