Skip to content

Commit

Permalink
Additional clarifications
Browse files Browse the repository at this point in the history
  • Loading branch information
leafpetersen committed Jul 18, 2017
1 parent 0a4078d commit dfcad38
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions docs/language/informal/toplevel-inference.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,17 @@ omitted types are treated as dynamic.


Otherwise, the missing types are filled in with the type from the overridden or
implemented method. If there are multiple overridden/implemented methods and
the type to be filled in does not agree, it is an error. If there is no
corresponding parameter position in the overridden method to infer from, it is
treated as dynamic (e.g. overriding a one parameter method with a method that
takes a second optional parameter).
implemented method. If there are multiple overridden/implemented methods, and
any two of them have non-equal types (declared or inferred) for a parameter
position which is being inferred for the overriding method, it is an error. If
there is no corresponding parameter position in the overridden method to infer
from and the signatures are compatible, it is treated as dynamic
(e.g. overriding a one parameter method with a method that takes a second
optional parameter). Note: if there is no corresponding parameter position in
the overriden method to infer from and the signatures are incompatible
(e.g. overriding a one parameter method with a method that takes a second
non-optional parameter), the inference result is not defined and tools are free
to either emit an error, or to defer the error to override checking.


### Setter return types
Expand Down Expand Up @@ -327,9 +333,10 @@ as the appropriate method call as defined in the spec.
disallowed here.
* The inference dependency of the identifier is itself if the identifier is
a candidate for inference. Otherwise there are no inference dependencies.
* A simple identifier denoting a formal parameter which has an annotated type is
an immediately evident expression and has the type with which it was
annotated.
* A simple identifier denoting a formal parameter which has an annotated type
and is not a promotion candidate is an immediately evident expression and has
the type with which it was annotated.
* Note: the treatment of promotion candidates is still under discussion.
* No inference dependencies.
* A function (or function expression) invocation with no omitted generic
arguments where the applicand is an IE that has an inferred type with a
Expand Down

0 comments on commit dfcad38

Please sign in to comment.