diff --git a/resources/type-system/strict-inference.md b/resources/type-system/strict-inference.md index 04f65c1894..918906a706 100644 --- a/resources/type-system/strict-inference.md +++ b/resources/type-system/strict-inference.md @@ -297,12 +297,14 @@ void main() { ### Function return types -Declaring a recursive local function, a top-level function, a method, a -typedef, a generic function type, or a function-typed function parameter -without a return type is an inference failure. The return type of non-recursive -local functions can always be inferred from downwards or upwards inference, as -it will have a body, and the return type of the body is known (even if there -are inference failures within). +Declaring a recursive local function, a top-level function, a static method, a +non-overriding instance method, a type alias, a generic function type, or a +function-typed function parameter without a return type is an inference +failure. The return type of non-recursive local functions can always be +inferred from downwards or upwards inference, as it will have a body, and the +return type of the body is known (even if there are inference failures within). +Declaring a setter without a return type is allowed; the return type is assumed +to be void. ```dart f1() { // Inference failure @@ -320,9 +322,16 @@ void main() { class C { m1() => 7; // Inference failure + get g => 7; // Inference failure + int _s; + set s(int value) => _s = value; // OK (void assumed for setter) static m2() => 7; // Inference failure } +class D extends C { + m1() => 9; // OK (overrides C.m1) +} + typedef Callback1 = Function(int); // Inference failure typedef Callback2(int i); // Inference failure