Skip to content

Commit dfcad38

Browse files
committed
Additional clarifications
1 parent 0a4078d commit dfcad38

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

docs/language/informal/toplevel-inference.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,17 @@ omitted types are treated as dynamic.
9999

100100

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

108114

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

0 commit comments

Comments
 (0)